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

Add option to delay overwrite until tween initialization #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chatziko
Copy link
Contributor

An annoying aspect of Actuate is that sequencing doesn't work out of the box:

Actuate.tween(target, 1, { x: 10 });
Actuate.tween(target, 1, { x: 20, y: 20 }).delay(1);

false needs to be manually added to the second .tween to prevent overwriting the first one. One would expect that it's trivial for Actuate to detect that the second tween will start after the first finishes. But in fact it's tricky, cause the overwrite happens before the .delay(1) modifier is even called!

A simple and natural solution is to perform the overwrite not when the tween is created, but when it actually starts (that is, after the delay).

Pros:

  • simple solution
  • consistent with the current semantics (and no change in the semantics at all unless the tween is delayed)
  • no overhead
  • less risky than passing false to tween

This PR implements this feature, I'm experimenting with it so I thought to share.

(For simplicity, I added a global Actuate.delayOverwrite flag controling this behaviour, but of course there are more flexible ways.)

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 this pull request may close these issues.

1 participant