vue集成animate.css
一 `
一
使用
// 没有加name属性
组件动画效果
export default {
name: "App",
data() {
return { bol: true };
},
};
/* 进入动画 */
.v-enter-active {
animation: move 1s;
}
/* 离开动画 */
.v-leave-active {
animation: move 1s reverse;
}
@keyframes move {
from {
transform: translateX(-100%);
}
to {
transform: translate(0);
}
}
// 加上name属性,并且加上appear属性
组件动画效果
export default {
name: "App",
data() {
return { bol: true };
},
};
/* 类名要对应回 name 的属性值 */
.moveCartoon-enter-active {
animation: move 1s;
}
.moveCartoon-leave-active {
animation: move 1s reverse;
}
@keyframes move {
from {
transform: translateX(-100%);
}
to {
transform: translate(0);
}
}
二 关于animate.css
介绍animate.css 常用的几种分类
Attention seekers:用于引人注目的动画,比如刚进一个网站,要凸显的某个地方,可以用这个动画。Bouncing entrances 与 Bouncing exits 弹跳入场与弹跳出场的动画。Fading entrances 与 Fading exits 淡入浅出的动画Rotating entrances 与 Rotating exits 旋转入场与旋转出场的动画Zooming entrances 与 Zooming exits 缩放入场与缩放出场的动画Sliding entrances 与 Sliding exits 侧边划入与侧边划出的动画
三 vue集成animate.css
npm i animate.css在main.js 中 引入 import ‘animate.css’;
使用
例如:
name="animate__animated animate__bounce" enter-active-class="animate__swing" leave-active-class="animate__fadeOutTopLeft" > ...
推荐阅读
发表评论