Skip to content

Animations: end state style regression #16947

Closed

Description

@dharders

I'm submitting a ...

[x] bug report

Current behavior

Follow up to #16919

Using the latest master builds, with PR #16937 merged, some animation end styles are now too persistent. i.e. they stay even after setting a new state or the wrong style is persisted.

Last working version was 4.2.0-beta.1. (PR #16937 addressed reported issues in #16919 of 4.2.0-rc.0, but this issue slipped through)

Expected behavior

Expect the last style in the transition([]) to be persisted if outside of a parallel group(). Also, if a state change occurs 'in-flight' of another animation, I expect the new state styles (and or animation) to be applied.

Minimal reproduction of the problem with instructions

Repro: https://plnkr.co/edit/fWaBeI?p=preview (uses master builds)

I expect the opacity to be 1 after the animation finishes. i.e. the 'normal' state

The group() end styles are overriding the last animate(style()) in the plunker above. i.e. it seems to be ignoring the order

trigger('transAnim', [
   state('normal', style({ transform: 'translate3d(0px, 0px,0)', opacity: '1' })),
   state('intrans', style({ transform: 'translate3d(90px, 0px,0)', opacity: '0' })),
   transition('normal => intrans',
     [
       style({ opacity: '1' }),
       group([
         animate('1000ms 200ms', keyframes([
           style({ transform: 'translate3d(0px, 0px,0)', offset: 0.25 }),
           style({ color: '#ffffff', offset: 0.7 }),
           style({ transform: 'translate3d(90px, 0px,0)', offset: 1 }),
         ])),
         animate('500ms 1100ms ease-in-out', style({ opacity: '0' }))
       ]),
       style({ transform: 'translate3d(0px, 0px,0)' }),
       animate('500ms 50ms ease-in-out', style({ opacity: '1' })),
     ])
 ])

Also, changing the state back to 'normal' before the 'intrans' animation is complete, I'd still expect it to apply the 'normal' styles.

What is the motivation / use case for changing the behavior?

Fix animation end styling. Behave as it did in v4.2.0-beta.1

You can set the plunker ng version in systemjs.config.js back to 4.2.0-beta.1 to see the desired behaviour.

Don't forget to set ngNightly = false;

var ngVer = '4.2.0-beta.1';
var ngNightly = false;         // set false to use ngVer

Please tell us about your environment:

Windows 7, code, yarn, ng-cli

  • Angular version: 4.2.0-rc.0 and latest angular/*-builds
  • Browser: Tested in Chrome Desktop, and iOS Safari / WKWebView
  • Language: Typescript 2.3.2

  • Node (for AoT issues): node --version =

/cc @matsko

Activity

  1. dharders commented on May 23, 2017

    @dharders
    Author

    Experimenting with the plunker, I noticed another difference in behavior between 4.2.0.beta.1 and rc.0 which may or may not explain this bug.

    **beta 1 order of animations/styles: **
    style({ opacity: '1' })
    then group([...])
    then style({ transform: 'translate3d(0px, 0px,0)' })
    then animate('500ms 50ms ease-in-out', style({ opacity: '1' }))

    **rc 0 order of animations/styles: **
    style({ opacity: '1' }) and style({ transform: 'translate3d(0px, 0px,0)' })
    then group([...])
    then animate('500ms 50ms ease-in-out', style({ opacity: '1' }))

    I discovered this by applying a backgroundColor style within the group() and outside in the second last style()

    i.e.

    trigger('transAnim', [
       state('normal', style({ transform: 'translate3d(0px, 0px,0)', opacity: '1' })),
       state('intrans', style({ transform: 'translate3d(90px, 0px,0)', opacity: '0' })),
       transition('normal => intrans',
         [
           style({ opacity: '1' }),
           group([
             animate('1000ms 200ms', keyframes([
               style({ transform: 'translate3d(0px, 0px,0)', offset: 0.25 }),
               style({ color: '#ffffff', offset: 0.7 }),
               style({ transform: 'translate3d(90px, 0px,0)', offset: 1 }),
             ])),
             animate('500ms 1100ms ease-in-out', style({ opacity: '0', backgroundColor: 'rgba(0, 191, 255, 0.5)' }))
           ]),
           style({ transform: 'translate3d(0px, 0px,0)', backgroundColor: 'rgba(0, 191, 255, 1.0)' }),
           animate('500ms 50ms ease-in-out', style({ opacity: '1' })),
         ])
     ])

    The above works in beta.1 but fails to build with rc.0 with the error:

    The CSS property "backgroundColor" that exists between the times of "0ms" and "1600ms" is also being animated in a parallel animation between the times of "0ms" and "1600ms"

    I assume this is a bug, but my mental model of animation order might be incorrect too. Can you please confirm @matsko ? Since it worked in previous versions, I assume the previous way was correct.

  2. added
    area: animations
    on May 23, 2017
  3. changed the title [-]Animations: end state style sometimes incorrect [/-] [+]Animations: end state style regression[/+] on May 25, 2017
  4. added a commit that references this issue on May 31, 2017
    665e707
  5. dharders commented on Jun 5, 2017

    @dharders
    Author

    Found a regression with mid-flight animation state changes.

    Created issue #17170

  6. added a commit that references this issue on Aug 11, 2017
    6d5edcc
  7. added a commit that references this issue on Aug 28, 2017
    1764e14
  8. angular-automatic-lock-bot commented on Sep 11, 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.

  9. locked and limited conversation to collaborators on Sep 11, 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: animations

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions