Skip to content

If an Animation instance is played more than once, the same promise is resolved each time leading to unexpected results. #774

Closed

Description

@hamorphis

Since the finished promise of an Animation is one and the same during the life of the animation, the Animation cannot be properly played multiple times, i.e. the following code fails:

animation1.play().finished
    .then(function () { return animation1.play().finished; })
    .then(function () { return animation1.play().finished; })

We should make the play() method return a new Promise each time it is played.

In other words, there should be a new promise returned for each play invocation -- not one promise per Animation instance.

Activity

  1. self-assigned this
    on Sep 18, 2015
  2. added this to the 1.4.0 milestone on Sep 18, 2015
  3. added a commit that references this issue on Sep 21, 2015
  4. hamorphis commented on Sep 21, 2015

    @hamorphis
    ContributorAuthor

    Breaking changes

    • (#774) Animation class no longer has a finished property because an animation can be played multiple times. The play method now returns a new Promise each time it is invoked. Use this to listen for the animation finishing or being cancelled. When upgrading to version 1.4.0 or above simply remove .finished from your code.

    Old Code (JavaScript):

    animation1.play().finished.then(function () { console.log("Finished"); });

    New Code (JavaScript):

    animation1.play().then(function () { console.log("Finished"); });

    Old Code (TypeScript):

    animation1.play().finished.then(()=>console.log("Finished"));

    New Code (JavaScript):

    animation1.play().then(()=>console.log("Finished"));
  5. lock commented on Aug 30, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  6. locked and limited conversation to collaborators on Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions