Closed pixelzoom closed 4 years ago
I thought this might be related to changes made for phetsims/phet-info#126, but I rolled back to 84fbf5bc6f4fb1783bb99649ca365cb0d51401e9 and that's not the case.
I'm guessing this is failing because the distance to animate is zero. So that probably results in a divide-by-zero error somewhere.
Here's the divide-by-zero problem, in Animation.js:
312 const ratio = Utils.clamp( ( this.length - this.remainingAnimation ) / this.length, 0, 1 );
this.length
is the computed duration of the animation (in seconds), and it's 0 because the start and end positions are the same.
This is a general problem with Animation, which I've reported in https://github.com/phetsims/twixt/issues/27. If the marker doesn't need to move, then the Animation has duration: 0
, and that will fail with a divide-by-zero (NaN
) error.
This problem was introduced in this sim when MoveTo
was replaced by Animation
on 8/24/18. I'm going to work around it by adding logic to create the Animation only when duration
> 0.
Fixed in the above commit. Since this issue never appeared in a released version, I'm going to go ahead and close it.
Since phetsims/twixt#27 has been fixed, I removed the workaround that was added in https://github.com/phetsims/unit-rates/commit/b66d080e503e261c0b4ea610cae7c61a5a6bec5c.
Steps to reproduce: