如何在uni-app 中使用动画-animation
1.dom元素中添加:animation="animationData"
:animation="animationData">
2.js中相应添加
export default {
data() {
return {
pageY: 0, //触摸点
offsetTop: 0, //偏移量
newTop: 200,
show: false,
animationData: {},
off: false
};
},
onLoad() {},
onShow() {
// 初始化一个动画
var animation = uni.createAnimation({
transformOrigin: "ease-in",
duration: 100, //动画持续1秒
// timingFunction: 'linear', //linear 全程匀速运动
// delay:300 //延迟两秒执行动画
})
this.animation = animation
},
methods: {
touchendTest() {
// console.log('开始回弹动画');
this.newTop = 200;
this.scaleAndScale()
}