Anime: How to run an accurate duration opacity animation with anime.js?

Created on 8 Nov 2017  路  2Comments  路  Source: juliangarnier/anime

I'm trying to fade out an element with _anime.js_.
The code works but the duration does not correspond with the duration param I'm giving.

For example when I set duration to five seconds, it takes about half of that.

https://codepen.io/anon/pen/rYLRQq

 anime({
   targets: '.el',
   opacity: 0,
   duration: 5000
 });

Also there's a noticable difference in duration between firefox and chrome.

Is there a way to have it more accurate?

Most helpful comment

The duration is correct. I think the issue you're seeing is that the default easing for anime is set to easeOutExpo. If you set it to linear it should be more "accurate".

All 2 comments

The duration is correct. I think the issue you're seeing is that the default easing for anime is set to easeOutExpo. If you set it to linear it should be more "accurate".

Duration is accurate, but visually wrong since you're using the default easing timing function, which is 'easeOutElastic', as @alexchantastic says, use 'linear' instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LiveLikeCounter picture LiveLikeCounter  路  3Comments

lukebatchelor picture lukebatchelor  路  7Comments

DavudSafarli picture DavudSafarli  路  5Comments

bofeiw picture bofeiw  路  4Comments

Elaborate3P1C picture Elaborate3P1C  路  7Comments