do not default to global TWEEN group for new Tweens, do not auto-add/remove tweens from groups, and update docs accordingly #688
+4,607
−1,425
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: do not automatically add/remove a tween to/from its associated group
feat: the
tween.group(group)
method now has a reciprocaltween.remove()
method that will remove a tween from its associated group, and unassociate the group.tween.group()
without an arg is no longer valid, see breaking changes and migration below.fix: when a tween is stopped before its end time, do not allow its update method to continue, therefore preventing logic (f.e. repeat logic) from being triggered
docs: improved the docs, adding some missing information, removing all examples of the global
TWEEN
group which has been deprecated, and adding docs on how to manage groups of tweens. Also updated samples to useimport
syntax for importing Tween, avoiding the use of theTWEEN
UMD global variable which has been deprecated.feat: A new
Group.allStopped()
method returns true if all tweens in a group are not playing (i.e. stopped, and not paused), otherwise false. Useful for stopping an animation loop once all tweens in a group have finished their animation.BREAKING:
start()
,stop()
, orpause()
, and thepreserve
parameter toGroup.update()
now defaults totrue
and is deprecated to be removed in a future major version.group.update()
withfalse
for the second parameter. To migrate forward, do not rely on automatic add/remove of tweens, and instead add/remove tweens to/from groups manually.Group.update()
no longer returns a boolean indicating if all tweens have been removed.Group.allStopped()
method to check if all tweens in a group are stopped in order to determine whether or not to continue an animation loop.group
parameter toTween.constructor
now defaults toundefined
instead of the globalTWEEN
group. Additionally it accepts a value oftrue
to restore the old default behavior. Thetrue
value is deprecated and will be removed in a future major version.true
to restore the old behavior. To migrate forward, usetween.group(group)
orgroup.add(tween)
instead.tween.group()
signature has been removed.group.add(tween)
orgroup.remove(tween)
instead.tween.group(TWEEN)
,TWEEN.add(tween)
, andTWEEN.remove(tween)
will also work for now, but they are deprecated and will be removed in a future major version.Group.update
's second parameterpreserve
defaults totrue
now, and is deprecated to be removed in a future major version, at which point tweens of a group will no longer be automatically added/remove to/from a group when calling any Tween methods such asstart()
,pause()
, orstop()
.false
to restore old default behavior when callinggroup.update()
. To migrate forward, do not rely on the automatic add/remove behavior, and instead manually add or remove tweens to or from groups.tween.update()
to be a no-op for stopped tweens, we had to break an undocumented feature that allowed tweens to move backward in time (added preservation flag in TWEEN.update to be able to go backward in time #271).tween.start(startTime)
then proceed to calltween.update(time)
in reverse order as before (see the unit test with "go backward in time" in its name). Without callingtween.start()
nothing will happen because stopped/completed tweens will now always return early fromupdate()
, as they are considered to be no longer running.