Skip to content

Renderer.animate(...).play() resets animation to its initial state on finish #12456

Closed

Description

@alobakov

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request

Current behavior
When Renderer.animate(...).play() is called, the animation is played back correctly, but immediately jumps to the initial state once finished. The default 'fill' : 'both' option passed into the constructor of WebAnimationsPlayer by WebAnimationsDriver has no effect due to an explicit call to this._player.reset() being performed from within WebAnimationsPlayer.destroy().

Expected behavior
Finished animations should not be reset by the destructor of WebAnimationsPlayer.

Minimal reproduction of the problem with instructions

At the end of the animation, the element jumps right back to its initial position:
this._renderer.animate( element.nativeElement, { styles: [{transform : 'translate(0, 0)'}] }, [ { offset: 1, styles: { styles: [{transform : 'translate(100px, 200px)'}] } } ], 5000, 0, 'ease' ).play();

What is the motivation / use case for changing the behavior?
Since 'fill':'both' is used by WebAnimationsDriver as the default animation-fill-mode, when animation completes the target element must have its styles set to those specified in the respective end keyframe.

Please tell us about your environment:
Win10
VS Code 1.6.1
npm 3.10.3
node 6.3.1
@angular 2.1.0
AspNet.Core 1.0.1

  • Angular version: 2.1.0
  • Browser: [Chrome 53 | Opera 40.0]
  • Language: [TypeScript 2.0 | ES6]

Activity

  1. matsko commented on Nov 4, 2016

    @matsko
    Contributor

    Turns out that this needs to be changed anyway to make web workers work with animations!

    #12719

  2. added a commit that references this issue on Nov 9, 2016
    fe35bc3
  3. angular-automatic-lock-bot commented on Sep 10, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: animationslegacy animations package only. Otherwise use area: core.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions