diff options
Diffstat (limited to 'tools/mq_editor/mq_synth.js')
| -rw-r--r-- | tools/mq_editor/mq_synth.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/mq_editor/mq_synth.js b/tools/mq_editor/mq_synth.js index f1c7f73..8dcb4bd 100644 --- a/tools/mq_editor/mq_synth.js +++ b/tools/mq_editor/mq_synth.js @@ -4,7 +4,9 @@ // Evaluate cubic bezier curve at time t function evalBezier(curve, t) { // Normalize t to [0, 1] - let u = (t - curve.t0) / (curve.t3 - curve.t0); + const dt = curve.t3 - curve.t0; + if (dt <= 0) return curve.v0; + let u = (t - curve.t0) / dt; u = Math.max(0, Math.min(1, u)); // Cubic interpolation |
