在这里我使用的是animejs
首先通过npm install animejs --save
然后在通过import导入 import anime from 'animejs'
在vue的methods中自定义方法
比如
go () {
return new Promise((resolve) => {
anime({
targets: this.$el,
rotateY: [0, 360],
duration: 100,
easing: 'easeInOutQuart',
complete: () => {
anime({
targets: this.$el,
rotateY: [0, 120],,
complete: () => {
resolve(true)
}
})
}
})
})
}
用法是-动画首先执行按y轴旋转360度,在该动画执行完成之后再执行动画按y轴旋转120度
使用起来很方便!!