@xg4/motion
v0.1.0
Published
motion by requestAnimationFrame
Downloads
15
Maintainers
Readme
Motion
Installation
Install with npm or Yarn
# npm
$ npm install @xg4/motion --save# yarn
$ yarn add @xg4/motionUsage
import { move } from '@xg4/motion'
import { easeInOutCubic } from '@xg4/easings'
move(handler, {
from: 0,
to: 100,
duration: 3000,
ease: easeInOutCubic
})
function handler(value) {
// value (0~100)
console.log(value)
}Move Options
| name | type | default | description | | -------- | -------- | -------------- | -------------------- | | from | number | 0 | 起始值 | | to | number | 0 | 结束值 | | duration | number | 450 | 运动持续时间 | | ease | function | easeInOutCubic | 缓动函数 | | count | number | 1 | 运动次数 | | reverse | boolean | false | 反复运动时,是否反转 |
Contributing
Welcome
Fork it
Submit pull request
LICENSE
MIT
