You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge branch 'main' into fix-yoyo-wrong-by-calculateElapsedPortion
* main:
code formatting
update tests.yml: use npm ci instead of npm i for reproducible builds
Update tests.yml: update setup-node action version
Update tests.yml to use the latest LTS version of Node.js
#697: Added a section in the user-guide regarding the new "setNow" functionality.
#697: Added the ability to override the internal "now" function using the "setNow" function.
fix: Fixed error when registered tweens are not completed in order
fix: Fixed error when registered tweens are not completed in order
test: add test tween unit
feature: implement group-level onComplete callback, triggering both group and individual tween completion callbacks
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
Copy file name to clipboardExpand all lines: docs/user_guide.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -642,6 +642,12 @@ Note that the interpolation function is global to all properties that are tweene
642
642
643
643
Check [06_array_interpolation](../examples/06_array_interpolation.html) for an example.
644
644
645
+
## Changing the Definition of "Now"
646
+
647
+
When working with tweening, you inevitably rely on a definition of what "now" is. By default, Tween.js uses performance.now, which is a reliable and precise approach. However, if you need to adjust the flow of time—for instance, to slow it down or manipulate it for a custom purpose—you may encounter discrepancies between your internal definition of "now" and what Tween.js considers "now."
648
+
649
+
To address this, a new function, setNow, has been introduced. This function allows you to redefine the internal "now" used by Tween.js. You can pass a custom function to setNow, which will replace the default definition. This provides greater flexibility and enables synchronization with your specific requirements for time control.
650
+
645
651
## Getting the best performance
646
652
647
653
While Tween.js tries to be performant on its own, nothing prevents you from using it in a way that is counterperformant. Here are some of the ways you can avoid slowing down your projects when using Tween.js (or when animating in the web, in general).
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
0 commit comments