Socket
Book a DemoInstallSign in
Socket

@kunukn/tween

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kunukn/tween

tween

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

tween

Run a tween with fixed duration. Update callback is invoked on progress of the tween. The progress is a range value from [0;1]. The value 0 and 1 is guaranteed to be called during the tween.

usage

examples

var tween = require("@kunukn/tween");
var log = console.log.bind(console);

function onComplete(arg){
  log(arg);
  log('** example done');
}

log('**  example start');
tween({ duration: 500, update: log, complete: onComplete });
import tween from '@kunukn/tween';
const onUpdate = range => console.log(range);
const onComplete = ({ startTime, now, elapsedTime }) => console.log(startTime, now, elapsedTime);
tween({ duration: 500, update: onUpdate, complete: onComplete, ensureLast: true });

tween arguments:

  • duration in milli seconds
  • update is a function called on tween update with range value between [0;1]
  • complete is function called when the tween is done
  • ensureLast is default true and ensures update(1) is called as the last step.

npm

https://www.npmjs.com/package/@kunukn/tween

cdn

https://unpkg.com/@kunukn/tween/

FAQs

Package last updated on 14 Jan 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