Skip to content

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