Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
tween-functions
Advanced tools
The tween-functions npm package provides a collection of easing functions for use in animations. These functions help in creating smooth transitions between values over time, which is essential for animations in web development, game development, and other interactive applications.
Linear Easing
Linear easing provides a constant rate of change from the start value to the end value. This is useful for simple, uniform animations.
const tweenFunctions = require('tween-functions');
const startValue = 0;
const endValue = 100;
const duration = 1000;
const currentTime = 500;
const value = tweenFunctions.linear(currentTime, startValue, endValue - startValue, duration);
console.log(value); // 50
Ease In Quad
Ease In Quad starts the animation slowly and then accelerates. This is useful for animations that need to start gently and then speed up.
const tweenFunctions = require('tween-functions');
const startValue = 0;
const endValue = 100;
const duration = 1000;
const currentTime = 500;
const value = tweenFunctions.easeInQuad(currentTime, startValue, endValue - startValue, duration);
console.log(value); // 25
Ease Out Bounce
Ease Out Bounce creates a bouncing effect at the end of the animation. This is useful for playful or attention-grabbing animations.
const tweenFunctions = require('tween-functions');
const startValue = 0;
const endValue = 100;
const duration = 1000;
const currentTime = 500;
const value = tweenFunctions.easeOutBounce(currentTime, startValue, endValue - startValue, duration);
console.log(value); // 75
tween.js is a popular JavaScript tweening engine that provides a wide range of easing functions and more advanced features like chaining and interpolation. It is more feature-rich compared to tween-functions and is widely used in game development and interactive applications.
GSAP (GreenSock Animation Platform) is a powerful animation library that offers a comprehensive suite of tools for creating high-performance animations. It includes a variety of easing functions and is known for its robustness and flexibility, making it a more advanced option compared to tween-functions.
animejs is a lightweight JavaScript animation library that provides a simple API for creating complex animations. It includes a variety of easing functions and supports multiple animation types, making it a versatile alternative to tween-functions.
Robert Penner's tweening functions as used in React-tween-state and React-state-stream.
Penner's original functions uses the change in value rather than final value as parameter. I much prefer the latter, so this is what this library will use.
tweenFunction.tweenName(currentTime, beginValue, endValue, totalDuration)
var tweenFunctions = require('tween-functions');
tweenFunctions.easeInQuad(1, 0, 50, 5); // => 4
List of available functions:
FAQs
Robert Penner's easing functions, slightly modified
The npm package tween-functions receives a total of 1,768,162 weekly downloads. As such, tween-functions popularity was classified as popular.
We found that tween-functions 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.