Skip to content

[BUG] (easing spring) - perceived complete callback/duration is not calculated automatically #1118

@nikita-emelianov

Description

@nikita-emelianov

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

Image

actual result: onComplete is always called after the default duration (628ms), ignoring the computed duration

Image

The computed values from the stiffness and dumping setters (which contain the necessary calculations) are not used in the constructor

Source:

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();

Provide a minimal reproduction demo of the bug

https://codepen.io/Nikita-Emelianov/pen/QwNMXVg

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions