question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grouping all animations into one single RAF

See original GitHub issue

Right now every anime instance will create a new RAF. I started doing some performance test with a single RAF, and the results are really good (up to 20/30% faster when a lot of animation are running simultaneously). You can test it here https://github.com/juliangarnier/anime/tree/single-RAF.

My only concern is the use of performance.now(), not sure if it’s still too early to use http://caniuse.com/#feat=high-resolution-time.

Some tests: Old: http://codepen.io/juliangarnier/full/545d66779d81ee68062bc8db018f6ee1/

New with a single RAF: http://codepen.io/juliangarnier/full/f56c939864ea6b1b6efa8726e7ea8119/

Feedbacks are welcome.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
juliangarniercommented, Jan 4, 2017

I think it’s actually possible to do what you described. Anime expose the .tick() function of an animation, and you can do things like this :

var myAnimation = anime({
  targets: '.particule',
  translateX: 100,
  autoplay: false
});


function render(time) {
  myAnimation.tick(time);
  requestAnimationFrame(render)
}

render();
2reactions
devmariocommented, Jun 30, 2016

If you use single RAF, I have an idea For example

var factory = new animeFactory();
var aim = new anime();
factory.add(anim);
factory.tick(timeElepse/* avail negative */);

We can create slow-motion animation and invert animation, as applied to all animation on browser.

This is my cpp animation manager. https://github.com/devmario/CppTweener/blob/master/tween.h https://github.com/devmario/CppTweener/blob/master/tween.cpp

Read more comments on GitHub >

github_iconTop Results From Across the Web

Group and animate a set of objects - Microsoft Support
Hold down the Ctrl key and click all the objects that you want to animate together. · Right-click the selected objects, and then...
Read more >
JavaScript rAF in a nutshell (requestAnimationFrame) - Medium
A very small intro to requestAnimationFrame function in JavaScript to achieve smooth animations. (source: unsplash.com). requestAnimationFrame was one of ...
Read more >
Make groups of objects appear and disappear in sequence ...
First: if you need to assign multiple animations to a single shape, don't use the Animation tab for the second and later animations....
Read more >
A Guide to SVG Animations (SMIL) - CSS-Tricks
All animation elements also share another attribute: attributeName . The attributeName attribute is used to specify the name of the attribute ...
Read more >
Towards an animation smoothness metric - web.dev
We've probably all interacted with an interface which just added too ... or "rAF", tells the browser that you wish to perform an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found