v24.0.0 - groupies!
This release finally deprecates usage of TWEEN
as a default Group
. All new Tween
s now default to having no group, and must be explicitly added to a group if desired. Plus some other improvements to related to groups, including breaking changes (see below for all details and how to migrate if affected).
What's Changed
- Tiny readme fix for import-map example code. by @Bug-Reaper in #685
- do not default to global TWEEN group for new Tweens, do not auto-add/remove tweens from groups, and update docs accordingly by @trusktr in #688
New Contributors
- @Bug-Reaper made their first contribution in #685
More Details
feat: do not automatically add/remove a tween to/from its associated group, and do not automatically add new Tween
s to the global TWEEN
group by default.
feat: the tween.group(group)
method now has a reciprocal tween.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 use import
syntax for importing Tween, avoiding the use of the TWEEN
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.
deprecated: Methods on TWEEN
that come from Group
are now deprecated to be removed in a future major version. Migrate forward by making a new Group
instead of using TWEEN
as a group.
deprecated: The UMD script that creates a global TWEEN
variable is deprecated to be removed in a future major version.
deprecated: The CommonJS build is deprecated to be removed in a future major version.
BREAKING:
- Tweens are no longer automatically added or removed from groups by default when you call any Tween methods such as
start()
,stop()
, orpause()
, and thepreserve
parameter toGroup.update()
now defaults totrue
and is deprecated to be removed in a future major version.- MIGRATION: To keep old behavior for a while, explicitly call
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.
- MIGRATION: To keep old behavior for a while, explicitly call
Group.update()
no longer returns a boolean indicating if all tweens have been removed.- MIGRATION: Don't rely on auto-add/remove to/from groups. This boolean return was previously useful for stopping an animation loop once all tweens were finished animating. Instead, use the new
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.
- MIGRATION: Don't rely on auto-add/remove to/from groups. This boolean return was previously useful for stopping an animation loop once all tweens were finished animating. Instead, use the new
- The second
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.- MIGRATION: For the time being the parameter can be set to
true
to restore the old behavior. To migrate forward, usetween.group(group)
orgroup.add(tween)
instead.
- MIGRATION: For the time being the parameter can be set to
- The argless
tween.group()
signature has been removed.- MIGRATION: Use
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.
- MIGRATION: Use
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()
.- MIGRATION: For now, explicitly set the parameter to
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.
- MIGRATION: For now, explicitly set the parameter to
- To make the fix for
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 (#271).- MIGRATION: To move tweens backward in time after they have already completed, first call
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.
- MIGRATION: To move tweens backward in time after they have already completed, first call
Full Changelog: v23.1.3...v24.0.0