1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-26 17:54:52 +02:00

regenerated all images

This commit is contained in:
Pomax
2020-09-06 17:23:52 -07:00
parent 17c50a403b
commit 42b9818441
66 changed files with 407 additions and 328 deletions

View File

@@ -1,24 +1,17 @@
let curve;
let curve, ratios=[1, 1, 1, 1];
setup() {
curve = Bezier.defaultCubic(this);
setMovable(curve.points);
curve.points.forEach((p,i) => {
setSlider(`.ratio-${i+1}`, `!ratio-${i+1}`, 1, v => this.setRatio(i,v))
});
}
const inputs = findAll(`input[type=range]`);
if (inputs) {
const ratios = inputs.map(i => parseFloat(i.value));
curve.setRatios(ratios);
inputs.forEach((input,pos) => {
const span = input.nextSibling;
input.listen(`input`, evt => {
const value = parseFloat(evt.target.value);
span.textContent = ratios[pos] = value;
curve.update();
this.redraw();
});
})
}
setRatio(i, v) {
ratios[i] = v;
curve.setRatios(ratios);
redraw();
}
draw() {