Skip to content

problems with Animation.then #26

@pixelzoom

Description

@pixelzoom

I ran into this in Gas Properties, where I'm working around it, but it's not pretty.

The API for Animation.then needs to be reexamined. Specifically:

  • animation = new Animation(...).then(...).then(...) returns the last Animation in the chain, so animation.start only runs the last Animation in the chain. Probably not what was planned.

  • There is no way support for stopping a chained set of Animations.

@ariel-phet please prioritize and assign.

Slack conversation with @jonathanolson

Chris Malley [2:12 PM]
I have a Property that I want to animate from 0 to 1 to 0. How do I accomplish that with TWIXT/Animation?

Jonathan Olson [2:20 PM]
new Animation( { from: 0, to: 1, property: someProperty, duration: } )

Chris Malley [2:20 PM]
yes, that gets me from 0 -> 1.

Jonathan Olson [2:20 PM]
Oh sorry
chain them
so...

Chris Malley [2:21 PM]
const animation = new Animation( { from: 0, to: 1, property: someProperty, duration: } ).then( { from: 1, to: 0, property: someProperty, duration: } ) returns the 2nd animation.

Jonathan Olson [2:21 PM]
zeroToOneAnimation.then( oneToZeroAnimation ), if you step both
if you provide stepEmitter, that might be simpler?

Chris Malley [2:21 PM]
So animation.start does nothing.

Jonathan Olson [2:22 PM]
That is... unclean in the API sorry

Chris Malley [2:22 PM]
Indeed.

Jonathan Olson [2:22 PM]
so probably need to keep references, sorry
and I should improve that
thoughts on how things should be?

Chris Malley [2:22 PM]
But that’s the general idea then?

Jonathan Olson [2:22 PM]
yes

Chris Malley [2:22 PM]
Chaining doesn’t seem useful for then

Jonathan Olson [2:23 PM]
chaining should probably forward stepping or something more elaborate?

Chris Malley [2:23 PM]
I’m also wondering how I completely stop an Animation created with new Animation(...).then.
If it gets to the then animation and I don’t have a reference to it, looks like I’m out of luck. (edited)

Jonathan Olson [2:24 PM]
in general it should be rethought, sorry

Chris Malley [2:25 PM]
OK. I’ll work around it. Should I capture this in an issue?

Jonathan Olson [2:35 PM]
yes please

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions