<template>
<view class="content">
<view :animation="animationData" style="background:red;height:30rpx;width:30rpx" @click="rotateAndScale"></view>
</view>
</template>
<script>
export default {
data() {
return {
animationData: {},
}
},
methods: {
rotateAndScale: function() {
var animation = uni.createAnimation({
duration: 1000,
timingFunction: 'ease',
})
this.animation = animation
animation.scale(2, 2).step()
animation.translateY(200).step()
animation.scale(1, 1).step()
animation.rotate(1260).step()
animation.backgroundColor('blue').step()
animation.width('100%').step()
animation.rotate(0).step()
animation.translateY(0).step()
animation.height('100vh').step()
animation.backgroundColor('purple').step()
animation.height('10vh').step()
this.animationData = animation.export()
},
}
}
</script>
文章评论