anime
anime copied to clipboard
Loop: Number doesn't work in timelines
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.
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,
})
Loops in timelines will work in V4!