1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-22 00:07:10 +02:00

code comments

This commit is contained in:
Pomax
2020-09-19 14:16:00 -07:00
parent 7c530fee56
commit ad872f83c5
39 changed files with 306 additions and 117 deletions

View File

@@ -3,9 +3,15 @@ let curve, ratios=[1, 1, 1, 1];
setup() {
curve = Bezier.defaultCubic(this);
setMovable(curve.points);
curve.points.forEach((p,i) => {
for (let i=0; i<4; i++) {
// Set up a slider, but in a way that does not tie it to a variable
// that is exposed through `this`, because we want to store its value
// in the "ratios" array we already declared globally.
//
// To make that happen, we tell the slider logic that it should be
// calling the setRatio function instead when the slider moves.
setSlider(`.ratio-${i+1}`, `!ratio-${i+1}`, 1, v => this.setRatio(i,v))
});
}
}
setRatio(i, v) {