anime icon indicating copy to clipboard operation
anime copied to clipboard

Loop: Number doesn't work in timelines

Open different55 opened this issue 2 years ago • 2 comments

Describe the bug In timelines, looping for a certain number of iterations doesn't work, it'll freeze after the first loop.

To Reproduce Steps to reproduce the behavior:

anime.timeline().add({
    target: "body",
    opacity: 0,
    loop: 4,
    duration: 500,
    direction: "alternate",
});

Expected behavior Whole page should fade in and out several times.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Firefox
  • Version 98

Additional context Doing some console.logging in update and loopComplete callbacks, it looks like the animation within a timeline start out paused, but still plays through once, then immediately burns through all its loops when it reaches the end.

different55 avatar Apr 08 '22 20:04 different55

Actually, anime doesn't support loop for child animation in the timeline. So, we add a loop property for the timeline to resolve this problem. Hope it is useful for you. Here is a online demo

anime({
      targets: "body",
      opacity: 0,
      loop: 4,
      duration: 500,
      direction: 'alternate',
      autoplay: false,
})

Yukiniro avatar Feb 07 '23 07:02 Yukiniro

Loops in timelines will work in V4!

juliangarnier avatar Feb 14 '23 11:02 juliangarnier