Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The timeline autoplay property overwrites the autoplay property of added animations #894

Open
DanKaplanSES opened this issue May 12, 2024 · 3 comments · May be fixed by #898
Open

The timeline autoplay property overwrites the autoplay property of added animations #894

DanKaplanSES opened this issue May 12, 2024 · 3 comments · May be fixed by #898

Comments

@DanKaplanSES
Copy link

DanKaplanSES commented May 12, 2024

Describe the bug
When a standalone animation is created with an autoplay: false and duration: 0, its complete callback is never called. But pass the same properties into a timeline add and its complete callback will be called.

I believe this is a bug because none of the other properties I tried were overridden by the timeline.

To Reproduce
Steps to reproduce the behavior:

  1. Load this codepen.io: https://codepen.io/Daniel-Kaplan/pen/YzbPZWG?editors=1111
  2. Read the console

Expected behavior
The console should print no output because the animations have autoplay: false. You'll notice this is true for the standalone animation at the bottom, but the animations that are added to the timeline get their complete callback called so it prints output.

If you set the timeline's default autoplay to false, the example prints nothing, as expected. I.E.: const tl = anime.timeline({ autoplay: false }); does not print anything to the console, so in some situations, this can be used as a workaround.

Desktop (please complete the following information):

  • OS: Win 10
  • Browser: Firefox
  • Version 125.0.3 (64-bit)

Using anime.js 3.2.2

@different55
Copy link

different55 commented May 12, 2024

If a timeline is the sequence of a number of child animations, unlike all the other properties it only makes sense for autoplay to be global.

It's not clear what the expected behavior would even be. If a timeline has a number of both autoplay:true and false children, what happens to the timeline when one of the false children is reached in the sequence?

Similarly, it's not clear what should be autoplaying if the timeline is false but some children are true.

And for autoplay false children, individual children can't be accessed, so you can't call play() on them, and it's not clear what it means for the whole sequence when one (or multiple) segments within that sequence starts playing.

Best fix is probably to adjust the documentation so that this behavior is mentioned, because it's definitely the only sane behavior.

@DanKaplanSES
Copy link
Author

Best fix is probably to adjust the documentation so that this behavior is mentioned, because it's definitely the only sane behavior.

That works for me as a solution, too.

DanKaplanSES added a commit to DanKaplanSES/anime that referenced this issue May 18, 2024
@DanKaplanSES DanKaplanSES linked a pull request May 18, 2024 that will close this issue
@juliangarnier
Copy link
Owner

Best fix is probably to adjust the documentation so that this behavior is mentioned, because it's definitely the only sane behavior.

That works for me as a solution, too.

Fixed in V4 :)
Screenshot 2024-05-29 at 17 41 17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants