# lime-animateIt 元素动画 - 参考`createAnimation`的实现步骤,当前版本会有各平台表现不一致的问题 ## 安装 在插件市场导入即可 ## 使用 ```html // animationData 没有作用,只为兼容小程序 ``` ```ts import {createAnimation, CreateAnimationOptions} from '@/uni_modules/lime-animateIt' const viewRef = ref(null) animation.scaleX(0.5).translateX(200).step() animation.top(200).scaleX(1.8).step({duration: 600}) animation.top(100).left(-200).step({duration: 2000}) // 非小程序export不导致出任何内容,也不支持下面的参数 // 参数1: 需要动画的元素(非小程序必填) // 参数2: 循环次数 -1为无限(可选,不填则1次) animationData.value = animation.export(viewRef,2) // APP WEB animation.onFinish = ()=>{ console.log('onFinish') } const onClick = ()=>{ // APP WEB animation.play() } const onStop = ()=>{ // APP WEB animation.stop() } ``` ## API 可以参考[createanimation](https://uniapp.dcloud.net.cn/api/ui/animation.html#createanimation),但uniappX支持的动画有限[property](https://doc.dcloud.net.cn/uni-app-x/css/transition-property.html)