Skip to content

Incorrect console warning about not animatable property: easing #48571

Closed

Description

@drsno

Which @angular/* package(s) are the source of the bug?

animations

Is this a regression?

No

Description

When there is a sequenced animation, with animations having a different easing (for example the first animation having an ease-in, and the next animation having an ease-out), a console warning is given about 'easing' not being animatable.
Because easing is not animated, but rather is a property of the animation, the warning is incorrect.

Example animation:

  animations: [
    trigger('toolbarAnimations', [
      state('void, leave', style({ transform: 'translateY(-100%)' })),
      state('enter', style({ transform: 'none' })),
      transition(':enter', [
        sequence([
          animate('200ms ease-in', style({ transform: 'none' })),
          animate('200ms ease-out', style({ transform: 'translateY(-12px)' })),
          animate('250ms ease-in', style({ transform: 'none' })),
        ]),
      ]),
      transition(':leave', group([animate('300ms ease-in', style({ transform: 'translateY(-100%)' }))])),
    ])

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-7hjkrh?file=src/app/app.component.ts

Please provide the exception or error you saw

Warning: The animation trigger "toolbarAnimations" is attempting to animate the following not animatable properties: easing
(to check the list of all animatable properties visit https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties)

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 14.2.3
Node: 14.20.1
Package Manager: npm 6.14.17
OS: win32 x64

Angular: 14.2.3
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1402.3
@angular-devkit/build-angular      14.2.3
@angular-devkit/core               14.2.3
@angular-devkit/schematics         14.2.7
@angular-devkit/schematics-cli     14.1.2
@angular/cdk                       14.2.2
@angular/material                  14.2.2
@angular/material-moment-adapter   14.2.2
@schematics/angular                14.2.7
ng-packagr                         14.3.0
rxjs                               6.6.7
typescript                         4.6.4

Anything else?

It is still reproducible in Angular 15.0, see stackblitz example

Activity

  1. sOoN92 commented on Dec 22, 2022

    @sOoN92

    You can easily achieve the same result using ease-in-out, thus avoiding the warning in console.

      animations: [
        trigger('toolbarAnimations', [
          state('void, leave', style({ transform: 'translateY(-100%)' })),
          state('enter', style({ transform: 'none' })),
          transition(':enter', [
            sequence([
              animate('200ms ease-in-out', style({ transform: 'none' })),
              animate('200ms ease-in-out', style({ transform: 'translateY(-12px)' })),
              animate('250ms ease-in-out', style({ transform: 'none' })),
            ]),
          ]),
          transition(':leave', group([animate('300ms ease-in-out', style({ transform: 'translateY(-100%)' }))])),
        ])
  2. drsno commented on Dec 22, 2022

    @drsno
    Author

    This would avoid the warning (workaround the bug), but it will also change the animated result. We are aiming for a bounce effect that isn't achieved by using ease-in-out in all animations.

    See https://stackoverflow.com/questions/9629346/difference-between-css3-transitions-ease-in-and-ease-out#9636239 to see why the ease-in-out will give a different effect.

  3. dario-piotrowicz commented on Dec 23, 2022

    @dario-piotrowicz
    Contributor

    @noudenaa I've implemented the non-animatable warnings some time ago, sorry I must have missed the timing functions, I'll look at this very soon 🙂

    In the meantime, I hope that this is not blocking you? if I'm not mistaken the non-animatable warnings don't show up in production so this should hopefully just be an inconvenience during dev time?

  4. drsno commented on Dec 23, 2022

    @drsno
    Author

    Thanks. It is not blocking, the warnings indeed don't show up in production.

  5. added
    area: animations
    P3
    on Jan 4, 2023
  6. modified the milestone: Backlog on Jan 4, 2023
  7. xunillinux commented on Jan 20, 2023

    @xunillinux

    @dario-piotrowicz I get warnings for trying to animate stroke-dasharray. The animations work.
    mdn says stroke-dasharray is animatable (https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray)
    Can I somehow disable the warning or am I actually doing something wrong?

    animations: [
        trigger('wizardProgessAnimation', [
    
          state('*',
            style({ 'stroke-dasharray': '{{percentageParam}} 100' }),
            {params: { percentageParam: '0' }}
          ),
    
          transition(':enter', [
            animate('1s ease-out', keyframes([
              style({ 'stroke-dasharray': '{{percentageParam}} 100'})
            ]))
          ]),
    
          transition(':increment', [
            animate('1s ease-out', keyframes([
              style({ 'stroke-dasharray': '{{percentageParam}} 100'})
            ]))
          ]),
    
          transition(':decrement', [
            animate('1s ease-out', keyframes([
              style({ 'stroke-dasharray': '{{percentageParam}} 100'})
            ]))
          ]),
    
        ])
      ]
    
    
    <path class="wizard-progress-circle" [@wizardProgessAnimation]="{value: percentage, params: {percentageParam: percentage}}"
            d="M18 2.0845
              a 15.9155 15.9155 0 0 1 0 31.831
              a 15.9155 15.9155 0 0 1 0 -31.831"
          />
    
    
    .wizard-progress-circle {
      fill: none;
      stroke-width: 2.8;
      stroke-linecap: round;
    }
    
  8. dario-piotrowicz commented on Jan 22, 2023

    @dario-piotrowicz
    Contributor

    Hi @xunillinux I don't think you are doing anything wrong, the issue is that the check to see if a property is animatable has been implemented following this set of properties: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties

    The issue is that your property is an animatable svg one which happens to be also acceptable as css, thus it is not included in the list.

    I checked and various other svg attributes would cause the same problem: https://www.w3.org/TR/SVG/propidx.html

    The easiest solution for your problem would be to add all of those here:


    but in order to do that I think we may want to have a definitive source (like the one we have for the css animatable props) (the one I linked above does say that it is just informative, so I am not sure if that's reliable enough)

    The alternative would be to allow the developer to specify somewhere the properties they do not want non-animatable warnings for (no, there isn't currently a way to do so 😓), this would also make the warning more configurable. (I think this might be preferred if not many people animate svgs, if svg animation via angular animations is common then maybe we should focus on adding the svg properties instead).

    What do you think? Which from your perspective sounds like the way to go?

  9. xunillinux commented on Jan 25, 2023

    @xunillinux

    Hey @dario-piotrowicz Thank you for your answer.
    Okay I don't know how many people use svg animatable properties but I don't think I'm the only one. So maybe it would be good to add those to the list. But nevertheless I think a configuration option for disabling the warning for specific cases might be a good solution. There may be some other usecases where there is an unnecessary warning or maybe some people would choose to ignore the warning on purpose.

  10. dario-piotrowicz commented on Jan 26, 2023

    @dario-piotrowicz
    Contributor

    Cool, I can see that my PR for this current issue is getting merged soon 🙂, after that I'll look into adding the svg props and/or adding an option to disable warnings 🙂👍

    @xunillinux if you want please feel free to open an issue and tag me there, otherwise I guess I can just do it without an issue to back it up, whatever you prefer (if you create the issue I'll be easier to keep track of it and you can get notified there 🙂)

  11. added a commit that references this issue on Jan 26, 2023
    d36dfd4
  12. added a commit that references this issue on Feb 1, 2023
    2675191
  13. dario-piotrowicz commented on Feb 11, 2023

    @dario-piotrowicz
    Contributor

    @xunillinux regarding svg animatable attributes, I looked into adding them to our list of animatable props but I don't think that that is a viable option, because there are some svg attributes like display and overflow that conflict with the css list, making the whole check much much less accurate.

    So instead I've opted to add a way to ignore non-animatable props (#49036) please let me know what you think 🙂

  14. dario-piotrowicz commented on Feb 11, 2023

    @dario-piotrowicz
    Contributor

    @xunillinux If you want please have a look at the PR, especially the unit tests to see how I implemented the disabling and if that looks good for your use cases 🙂

    But tldr:

    • you can set disableAnimatableDevWarnings when setting up the BrowserAnimationsModule to completely disable the warning (if it really bothers you all the time)
    • or, you can set allowedProps in the specific transition call to fix a one-off issue (if you want the check/warning but it is bothering you in a specific situation)

    Please let me know what you think 🙂

  15. xunillinux commented on Mar 8, 2023

    @xunillinux

    @dario-piotrowicz Thanks alot! Yes I had a look at the PR and that should work fine for my case :)

  16. angular-automatic-lock-bot commented on Apr 8, 2023

    @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.

  17. locked and limited conversation to collaborators on Apr 8, 2023
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

    P3area: animationsbugstate: has PR

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions