New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tiny-tween-js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-tween-js

JS Component for tweening values easily

latest
Source
npmnpm
Version
0.9.5
Version published
Maintainers
1
Created
Source

Tiny Tween JS

Tiny Tween - A tiny (~5KB) JS Component for tweening values easily

Try it on Codepen

Tiny Tween Demo

Installation

Using package managers

yarn add tiny-tween-js

# OR

npm install tiny-tween-js

And include in your JS

import TinyTween from 'tiny-tween-js' // ES6

OR

Manually add as script

<script src="//unpkg.com/tiny-tween-js"></script>

And get the exposed class:

new window.TinyTween

Usage


const tweenOptions = { 
    target: document.getElementById('example'), // Optional target for value changes
    from: {'style.opacity': 0}, // FROM values to tween
    to: {'style.opacity': 100}, // TO values to tween
    duration: 2000, // In Milliseconds
    loop: true,  // Loop tween
    yoyo: true, // Play forward and then reverse to inital value
    autostart: false,
    ease: 'easeInOutCubic', // Easing effect, default is Linear
    onProgress: function(values){},
    onComplete: function(){},
};

// ES6 Usage
import TinyTween from 'tiny-tween-js'
let tween = new TinyTween(tweenOptions);

// Vanilla Usage
let tween = new window.TinyTween(tweenOptions);

tween.play(); // Play tween from current state
tween.pause(); // Pause tween at current state
tween.stop(); // Stop playing and reset
tween.seek(0.50); // Set progress of tween
tween.destroy() // destroy instance to free memory

TODO

  • Add seek method
  • Chain tweens

Credits

Easing functions Taken from https://gist.github.com/gre/1650294

Keywords

tween

FAQs

Package last updated on 09 Jun 2019

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