-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Describe the bug
Perceived onComplete callback doesn’t work properly when configuring a spring with stiffness, dumping, and mass.
spring({ stiffness: 30, dumping: 20, mass: 1, onComplete: () => console.log('completed') });
expected result: onComplete should be called after the calculated perceived duration
actual result: onComplete is always called after the default duration (628ms), ignoring the computed duration
The computed values from the stiffness and dumping setters (which contain the necessary calculations) are not used in the constructor
Source:
anime/src/easings/spring/index.js
Line 214 in b82b2c7
| set stiffness(v) { |
Because of this, the perceived duration stays at the default
So workaround for me right now is to call calculateBDFromSD directly which is not perfect (also you can set stiffness/dumping)
customSpring.calculateBDFromSD();