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

I started a bunch of tweens in the same "for" and they are not synchronized #116

Open
guifes opened this issue Dec 6, 2021 · 1 comment

Comments

@guifes
Copy link

guifes commented Dec 6, 2021

I would expect that any quantity of tweens started from the same "frame" would be always syncronized. But since SimpleActuator set the "startTime" var with:

Lib.getTimer()

every time a new tween is instantiated, each instance gets a slightly different time and thus get desynchronized from the others.

As a fix suggestion, maybe instead of lazily listening to Event.ENTER_FRAME, listen to it before any tweens are instantiated and keep a single value from Lib.getTimer() as startTime.

@guifes guifes changed the title I started a bunch of tweens in the same for and they are not synchronized I started a bunch of tweens in the same "for" and they are not synchronized Dec 6, 2021
@guifes guifes closed this as completed Dec 7, 2021
@guifes guifes reopened this Dec 12, 2021
@guifes
Copy link
Author

guifes commented Dec 13, 2021

#117 I've created a PR to fix this. Hope it helps. I think the PR version is better since, it guarantees that for all actuators instantiated in the same frame, they all get the same startTime, as already happens with "stage_onEnterFrame" that is called only once per frame and calls update on every actuators with the same "currentTime" instead of fetching a new Lib.getTimer() for each one.

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

No branches or pull requests

1 participant