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

四、效果展示

相关推荐
鹿心肺语4 分钟前
前端HTML转PDF的两种主流方案深度解析
前端·javascript
Lee川8 分钟前
CSS盒模型实战:用代码透视 `border-box`与 `content-box`的天壤之别
css
海石23 分钟前
去到比北方更北的地方—2025年终总结
前端·ai编程·年终总结
一个懒人懒人30 分钟前
Promise async/await与fetch的概念
前端·javascript·html
Mintopia36 分钟前
Web 安全与反编译源码下的权限设计:构筑前后端一致的防护体系
前端·安全
输出输入38 分钟前
前端核心技术
开发语言·前端
Mintopia42 分钟前
Web 安全与反编译源码下的权限设计:构建前后端一体的信任防线
前端·安全·编译原理
林深现海1 小时前
Jetson Orin nano/nx刷机后无法打开chrome/firefox浏览器
前端·chrome·firefox
黄诂多1 小时前
APP原生与H5互调Bridge技术原理及基础使用
前端
前端市界1 小时前
用 React 手搓一个 3D 翻页书籍组件,呼吸海浪式翻页,交互体验带感!
前端·架构·github