mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-23 00:33:12 +02:00
t-value control
This commit is contained in:
@@ -2382,6 +2382,7 @@ return {
|
||||
|
||||
toggle: function() {
|
||||
if (this.api) {
|
||||
this.customTimeValues = false;
|
||||
this.mode = (this.mode + 1) % fit.modes.length;
|
||||
this.fitCurve(this.api);
|
||||
this.api.redraw();
|
||||
@@ -2395,22 +2396,33 @@ return {
|
||||
api.drawGrid(10,10);
|
||||
|
||||
api.setColor('black');
|
||||
|
||||
if (!this.curveset && this.points.length > 2) {
|
||||
this.fitCurve(api);
|
||||
curve = this.fitCurve(api);
|
||||
}
|
||||
|
||||
if (curve) {
|
||||
api.drawCurve(curve);
|
||||
api.drawSkeleton(curve);
|
||||
}
|
||||
|
||||
api.drawPoints(this.points);
|
||||
|
||||
api.setFill(0);
|
||||
api.text("using "+fit.modes[this.mode]+" t values", {x: 5, y: 10});
|
||||
if (!this.customTimeValues) {
|
||||
api.setFill(0);
|
||||
api.text("using "+fit.modes[this.mode]+" t values", {x: 5, y: 10});
|
||||
}
|
||||
},
|
||||
|
||||
fitCurve(api) {
|
||||
let bestFitData = fit(this.points, this.mode),
|
||||
processTimeUpdate(sliderid, timeValues) {
|
||||
var api = this.api;
|
||||
this.customTimeValues = true;
|
||||
this.fitCurve(api, timeValues);
|
||||
api.redraw();
|
||||
},
|
||||
|
||||
fitCurve(api, timeValues) {
|
||||
let bestFitData = fit(this.points, timeValues || this.mode),
|
||||
x = bestFitData.C.x,
|
||||
y = bestFitData.C.y,
|
||||
bpoints = [];
|
||||
@@ -2423,6 +2435,8 @@ return {
|
||||
var curve = new api.Bezier(bpoints);
|
||||
api.setCurve(curve);
|
||||
this.curveset = true;
|
||||
this.sliders.setOptions(bestFitData.S);
|
||||
return curve;
|
||||
},
|
||||
|
||||
onClick: function(evt, api) {
|
||||
|
Reference in New Issue
Block a user