0.0.5 • Published 3 years ago

@byte1024/easing v0.0.5

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

easing

一些常用的缓动函数

Install

$ yarn add @byte1024/easing

Usage

import { motion, Easing } from '@byte1024/easing';

let from = 0,
	to = 300,
	duration = 2000,
	k = 0,
	start = undefined;

function run(t: number) {
	start = start || t;
	k = Math.min((t - start) / duration, 1);
	const a = motion(from, to, k, Easing.circInOut);
	console.log(a);
	k < 1 && requestAnimationFrame(run);
}

requestAnimationFrame(run);

Easing.<type>(k)

typeInOutInOutNone
linearxxx
quadx
cubicx
quartx
quintx
sinx
expox
circx
elasticx
backx
bouncex

License

The MIT License

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago