1.0.4 • Published 5 years ago

viktortween v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Lightweight tween util with 0 dependencies (677bytes gzipped)

Usage

tween(obj, prop, from, to, duration, ease = defaultEasing)

import { tween, easing } from 'viktortween'

let obj = {
  pos: { x: 0, y: 0 }
}

// Tween single property
tween(obj.pos, 'x', 0, 10, 1000)
.onUpdate((percentage) => {})
.onComplete(() => {})
.stop()

// Tween multiple props
tween(obj, 'pos', { x: 0, y: 0 }, { x: 10, y: 10 }, 1000)
.onUpdate((percentage) => {})
.onComplete(() => {})
.stop()

// Tween with other easing effect (default is easing.easeOutQuad)
tween(obj.pos, 'x', 0, 10, 1000, easing.easeInOutQuint)
1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago