Socket
Socket
Sign inDemoInstall

tween-functions

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tween-functions

Robert Penner's easing functions, slightly modified


Version published
Weekly downloads
1.8M
increased by2.69%
Maintainers
1
Weekly downloads
 
Created

What is tween-functions?

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.

What are tween-functions's main functionalities?

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

Other packages similar to tween-functions

Keywords

FAQs

Package last updated on 16 Oct 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc