
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
tweenyweeny
Advanced tools
A weeeally tweeny simple tweening library based on EventEmitter3.
Features:
linear)"start", "stop", "update", "complete" events available for full lifecycle awareness using EventEmitter3 APITween instances. Instance keeps last known value persistent and can be re-startedWorks in the Browser or Node. For the browser
requestAnimationFrameis used, where as in NodesetTimeout(0)is used. Frames are generated at the fastest rate available over the desired duration.
Install as dependency through npm.
npm install tweenyweeny
Simply create a new Tween object (optionally passing the desired duration in milliseconds, default is 150ms).
import { Tween } from "tweenyweeny";
const FROM = 10;
const TO = 20;
const DURATION = 1000; // 1 second
const EASE_FUNCTION = "easeOutQuad";
/* create an instance of Tween, re-use for future animations on same property if required */
const tween = new Tween(DURATION);
/* listen for updates */
tween.on("update", (currentValue) => {
myThing.theProp = currentValue;
});
tween.on("complete", () => {
/* animation done */
});
/* start animation */
tween.start(FROM, TO, EASE_FUNCTION);
/* or use the static method */
Tween.run(
(currentValue) => {
myThing.theProp = currentValue;
},
FROM,
TO,
DURATION,
EASE_FUNCTION
);
A Tween is an EventEmitter3 object, so all of that API is available to listen to events.
| Member | Parameters | Return Value | Description |
|---|---|---|---|
new Tween([duration]) | * (optional) duration: number - The animation duration in milliseconds (defaults to 150ms) | Tween | Create a new instance of Tweenwith the optional duration in milliseconds. |
.start(from, to[, easing]) | * from: number - The initial value to start the animation from * to: number - The value to end the animation with * (optional) easing: EasingFunctionName - The name of the easing function to use (defaults to easeOutQuad) | Promise<void> | Start the animation interpolating between the from and to values using the optional easing function name, return a promise.You can also bind to the complete event to be notified when done. |
.stop() | void | Stop the animation at the current value. | |
.onStart(callback) | * callback: () => void - The callback to bind the start event to | Tween | Shortcut for .on('start', callback) to bind a callback to the start event. |
.onUpdate(callback) | * callback: () => void - The callback to bind the update event to | Tween | Shortcut for .on('update', callback) to bind a callback to the update event. |
.onStop(callback) | * callback: () => void - The callback to bind the stop event to | Tween | Shortcut for .on('stop', callback) to bind a callback to the stop event. |
.onComplete(callback) | * callback: () => void - The callback to bind the complete event to | Tween | Shortcut for .on('complete', callback) to bind a callback to the complete event. |
.isRunning | boolean | Whether the tween is currently running | |
.currentValue | number | The last computed value for the tween. This will persist after the animation completes. |
| Event | Callback | Description |
|---|---|---|
"start" | (from: number, to: number) => void | Fired when the Tween is started with .start(). Passes the from and to values if needed. |
"update" | (currentValue: number) => void | Fired during each frame of the Tween during animation. Passes the current value. |
"stop" | (currentValue: number) => void | Fired when the Tween is stopped with .stop() or when .start() is called while a tween is running. Passes the current value value if needed. |
"complete" | (from: number, to: number) => void | Fired when the animation completes after calling .start(). Passes the from and to values if needed. |
| Member | Parameters | Return Value | Description |
|---|---|---|---|
Tween.run(callback, from, to[, duration, [easing]]) | * callback: (value: number) => void - The update function to call each frame with the current value * from: number - The initial value to start the animation from * to: number - The value to end the animation with * (optional) duration: number - The duration in milliseconds* (optional) easing: EasingFunctionName - The name of the easing function to use (defaults to "easeOutQuad") | Promise<void> | Create a new Tween with the given settings and start the animation, returning a promise. |
Tween.defaultDurationMs | number | The default duration to use for new instances. |
The following easing function names are available (see https://easings.net for demos):
"linear""easeInSine""easeOutSine""easeInOutSine""easeInQuad""easeOutQuad" (default)"easeInOutQuad""easeInCubic""easeOutCubic""easeInOutCubic""easeInQuart""easeOutQuart""easeInOutQuart""easeInQuint""easeOutQuint""easeInOutQuint""easeInExpo""easeOutExpo""easeInOutExpo""easeInCirc""easeOutCirc""easeInOutCirc""easeInBack""easeOutBack""easeInOutBack""easeInElastic""easeOutElastic""easeInOutElastic""easeInBounce""easeOutBounce""easeInOutBounce"Please report any issues, feedback, bugs or suggestions here.
FAQs
Simple tweening library based on EventEmitter3
We found that tweenyweeny demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.