Animate.css的使用

一、安装

bash 复制代码
npm install animate.css --save

二、引入

bash 复制代码
import 'animate.css';

三、使用

bash 复制代码
     <h1
      class="animate__animated animate__bounce"
      @mouseenter="mouseenter"
      @mouseleave="mouseleave"
    >
      An animated element
    </h1>



//在js中的方法
function mouseenter(e) {
  e.target.className = "animate__animated animate__bounce";
}
function mouseleave(e) {
  e.target.className = "";
}



//可以自行调节动画速度
/* This only changes this particular animation duration */
// 仅仅修改此动画
.animate__animated.animate__bounce {
  --animate-duration: 2s;
}

/* This changes all the animations globally */
// 全局修改动画
:root {
  --animate-duration: 800ms;
  --animate-delay: 0.9s;
}

四、效果展示

相关推荐
七灵微40 分钟前
【后端】单点登录
服务器·前端
持久的棒棒君5 小时前
npm安装electron下载太慢,导致报错
前端·electron·npm
crary,记忆7 小时前
Angular微前端架构:Module Federation + ngx-build-plus (Webpack)
前端·webpack·angular·angular.js
漂流瓶jz7 小时前
让数据"流动"起来!Node.js实现流式渲染/流式传输与背后的HTTP原理
前端·javascript·node.js
SamHou07 小时前
手把手 CSS 盒子模型——从零开始的奶奶级 Web 开发教程2
前端·css·web
我不吃饼干8 小时前
从 Vue3 源码中了解你所不知道的 never
前端·typescript
开航母的李大8 小时前
【中间件】Web服务、消息队列、缓存与微服务治理:Nginx、Kafka、Redis、Nacos 详解
前端·redis·nginx·缓存·微服务·kafka
Bruk.Liu8 小时前
《Minio 分片上传实现(基于Spring Boot)》
前端·spring boot·minio
鱼樱前端8 小时前
Vue3+d3-cloud+d3-scale+d3-scale-chromatic实现词云组件
前端·javascript·vue.js
zhangxingchao8 小时前
Flutter入门:Flutter开发必备Dart基础
前端