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

splines + slider refinement

This commit is contained in:
Pomax
2020-09-06 09:08:11 -07:00
parent 9434a71d34
commit 1de1fc9ce3
21 changed files with 324 additions and 258 deletions

View File

@@ -1,4 +1,4 @@
let points=[];
let points=[], weights;
setup() {
var r = this.width/3;
@@ -8,10 +8,21 @@ setup() {
y: this.height/2 + r * Math.sin(i/6 * TAU)
});
}
weights = new BSpline(this, points, !!this.parameters.open).formWeights();
points.forEach((_,i) => {
addSlider(`slide-control`, false, 0, 10, 0.1, i%2===1? 2 : 6, v => this.setWeight(i, v));
});
points = points.concat(points.slice(0,3));
setMovable(points);
}
setWeight(i, v) {
weights[i] = v;
}
draw() {
clear();
@@ -33,7 +44,7 @@ draw() {
drawSplineData() {
const spline = new BSpline(this, points, !!this.parameters.open);
spline.formWeights();
spline.weights = weights;
noFill();
setStroke(`black`);