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;
}

四、效果展示

相关推荐
Crystal3288 分钟前
Git 基础:生成版本、撤消操作、版本重置、忽略文件
前端·git·github
lichenyang4538 分钟前
React 组件通讯全案例解析:从 Context 到 Ref 的实战应用
前端
姓王者14 分钟前
chen-er 专为Chen式ER图打造的npm包
前端·javascript
青莲84314 分钟前
Android Jetpack - 2 ViewModel
android·前端
崽崽的谷雨18 分钟前
react里ag-grid实现树形数据展示
前端·react.js·前端框架
栀秋66619 分钟前
就地编辑功能开发指南:从代码到体验的优雅蜕变
前端·javascript·代码规范
国服第二切图仔21 分钟前
Electron for 鸿蒙PC项目实战案例 - 连连看小游戏
前端·javascript·electron·鸿蒙pc
社恐的下水道蟑螂28 分钟前
深度探索 JavaScript 的 OOP 编程之道:从基础到进阶
前端·javascript·架构
1_2_3_30 分钟前
前端模块联邦介绍
前端
申阳31 分钟前
Day 19:02. 基于 SpringBoot4 开发后台管理系统-项目初始化
前端·后端·程序员