1.0.7 • Published 3 years ago

yzk-tween v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Tween

npm-version npm-size npm-download

Intro

Simple、Lightful、Efficient tween interpolate library. less than 2kb.

Quick Start

install

npm install yzk-tween

usage example

import { Tween } from 'yzk-tween';

const params = {
    // startValue of tween.
    start: 0,
    // endValue of tween.
    end: 100,
    // the length of time that a tween takes to complete one cycle.
    duration: 3000,
    // repeat the tween repeat forever.
    infinite: true,
    // interpolate direction when repeat a tween.
    alternate: true,
    // how a tween progresses through the duration of each cycle.
    timing: v => {
      return v * v;
    },
    // get value of tween at current time.
    onUpdate: v => {
        console.log(v);
    },
    // a tween completed.
    onComplete: () => {
        console.log('mission completed');
    }
}

let t = new Tween(params);
t.start();

// stop this tween.
t.stop();

// reuse tween instance.
t.reset(params);
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago