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.

Chained Animation

See original GitHub issue

This can be an awesome feature for banner ad animation. I tried to do this:

anime({
    targets: '#test-1',
    translateX: 100,
    scale: [.5, 1],
    rotate: 180,
    delay: 1000,
    opacity: [0, 1],
    duration: 2000,
    easing: 'easeOutExpo',
});

anime({
    targets: '#test-1',
    translateX: 200,
    scale: [1, 2],
    rotate: 360,
    delay: 5000,
    opacity: 0,
    duration: 1000,
    easing: 'easeOutExpo',
});

But the first call was ignored. It’s possible to do an equivalent behavior? Basicly these steps:

  • Anime in
  • Wait X seconds
  • Anime out (with different parameters)

Thanks,

Jean

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

36reactions
misaundecommented, Mar 8, 2018

Really excited about this library.

If you call .finished, it will return a promise. Then you can use async/await:

async yourFunction() {   
   await anime({
      targets: '#test-1',
      translateX: 100,
      scale: [.5, 1],
      rotate: 180,
      delay: 1000,
      opacity: [0, 1],
      duration: 2000,
      easing: 'easeOutExpo',
  }).finished;
  
  await anime({
      targets: '#test-1',
      translateX: 200,
      scale: [1, 2],
      rotate: 360,
      delay: 5000,
      opacity: 0,
      duration: 1000,
      easing: 'easeOutExpo',
  }).finished;
}
2reactions
alexchantasticcommented, Oct 15, 2016

You can use the complete callback to chain animations like so:

anime({
    targets: '#test-1',
    translateX: 100,
    scale: [.5, 1],
    rotate: 180,
    delay: 1000,
    opacity: [0, 1],
    duration: 2000,
    easing: 'easeOutExpo',
    complete: function() {
        anime({
            targets: '#test-1',
            translateX: 200,
            scale: [1, 2],
            rotate: 360,
            delay: 5000,
            opacity: 0,
            duration: 1000,
            easing: 'easeOutExpo'
        });
    }
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Examples - Chained Animation - Phaser
Desktop and Mobile HTML5 game framework. A fast, free and fun open source framework for Canvas and WebGL powered browser games.
Read more >
Chaining CSS Animations using Javascript. | by Nishant Gupta
Why not chain animations using CSS animation-delays ? Let's assume we have animation 1: slideIn which is followed by animation 2 zoom ....
Read more >
Chained Animation: Collaborative Forms of ... - SAGE Journals
This article discusses experimental forms of collaborative filmmaking in education and introduces the pedagogical concept of Chained Animation.
Read more >
How to animate a chain in Blender - YouTube
In this short tutorial I wanted to quickly show you guys how to animate a chain in Blender. Anybody with an entry level...
Read more >
CSS Animation Tutorial #10 - Chaining Animations - YouTube
Hey gang, in this CSS animation tutorial I'll show you how we can chain 2 or more animations together on one element.
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