animate-native

1.0.1 • Public • Published

一个原生js的动画函数

用法

引用

let animate = require('animate-native');
import animate from 'animate-native';

使用方法

animate(ele, styles, options)

参数

  • ele: 使用动画的元素

  • styles: 变化的值

      变化的值: Object | Number
      例如:{left: 20, top: 100}
      值为Number时 默认变化的值是scrollTop
    
  • options: {

    speed: 'normal' | 'slow' | 'fast'

      完成时长: Number | String  
      normal: 400  
      slow: 600  
      fast: 200  
      可以手动配置(毫秒数)默认400  
    

    easing: easeIn | easeOut | easeInOut

      缓动类型: String  
      默认'easeInOut'  
    

    animation: Linear | Quad | Cubic | Quart | Quint | Sine | Expo | Circ | Elastic | Back | Bounce

      缓动函数名称: String  
      默认'Quart',可参考Tween函数  
    

    callback:

      回调函数: Function  
      动画执行完毕后调用
    

}

Readme

Keywords

Package Sidebar

Install

npm i animate-native

Weekly Downloads

4

Version

1.0.1

License

ISC

Last publish

Collaborators

  • hah