-
Notifications
You must be signed in to change notification settings - Fork 435
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 cancelTweensOf and completeTweensOf #2273
Conversation
@@ -37,6 +37,7 @@ class VarTween extends FlxTween | |||
_propertyInfos = []; | |||
this.duration = duration; | |||
start(); | |||
initializeVars(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are any of the changes in VarTween
changes besides the isTweenOf()
override related to this PR? It's not clear to me why they were made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It calls initializeVars earlier than before so that we can search _propertyInfos
in isTweenOf()
while that tween is in the delay phase. originally, this initialization was delayed until the tween starts so that chaining works correctly, but that delay is only needed for the startValues.
If you think I need to explain this in code, let me know
Added the ability to cancel or complete specific tweens without needing a reference to the tweens themselves. Useful when multiple things are applying tweens to the same object and want to remain agnostic of each other.
Usage:
also works with tweens that are not
VarTweens
by treating them asVarTweens
based on the properties they change, such as:AngleTween: "angle":
ColorTween: "color"
Motion (and all derivatives): "x" and "y"
completeTweensOf
works identical, but finishes the tween and calls onCompleteJust like with
VarTweens
, properties passed in can be dot paths to denote properties of children, this way any field passed in to a var tween can be used to cancel or complete the tweenExample:
fixes #2180