Animate动画插件

上次我们讲了一下swiper插件如何使用,这节我们来讲一下animate插件如何使用。同样,先打开官网:Animate中文网 – Animate安装、Animate使用、Animate下载。然后到代码托管平台GitHub上将文件下载:GitHub - animate-css/animate.css。便于使用,下图中圈起来的文件是我们所需要使用的文件。(animate.css文件和animate.min.css文件是一样的,带min的是压缩过后的,运行不会有任何影响)

一、使用

 同样,我们先在一个空白文件上面引入我们需要的css文件,这里写了一点内容方便做演示。

然后我们需要打开官网的演示网站

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="animate.min.css"/>
		<style type="text/css">
			.box1 {
				width: 200px;
				height: 100px;
				background-color: #0000FF;
			}
			.box2 {
				width: 200px;
				height: 100px;
				background-color: red;
			}
		</style>
		
	</head>
	<body>
		<div class="box1">
			
		</div>
		<div class="box2">
			
		</div>
		<h1 class="">我们是animate动画鸭</h1>
		<h4 class="">我们是animate动画鸭</h4>
		<h6 class="">我们是animate动画鸭</h6>
		
	</body>
</html>

 animate.css动画演示_dowebok

找到合适的效果样式,例如这个,我们只需要把他的名字copy一下。然后按照教程中如何添加类名的方法,在html对应的位置添加类名就好了。这个版本的animate动画类名添加方法是 

animate__animated animate__自己需要动画的类名

例如我们需要下面这个类名为bounceInDown的动画,则在对应的class类中加入animate__animated animate__bounceInDown就有对应的动画了

 下面我们为上面样式的盒子添加动画,效果如下。

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="animate.min.css"/>
		<style type="text/css">
			.box1 {
				width: 200px;
				height: 100px;
				background-color: #0000FF;
			}
			.box2 {
				width: 200px;
				height: 100px;
				background-color: red;
			}
		</style>
		
	</head>
	<body>
		<div class="box1 animate__animated animate__bounceInLeft">
			
		</div>
		<div class="box2 animate__animated animate__fadeInRight">
			
		</div>
		<h1 class="animate__animated animate__backInDown">我们是animate动画鸭</h1>
		<h4 class="animate__animated animate__flipInY">我们是animate动画鸭</h4>
		<h6 class="animate__animated animate__rotateInDownLeft">我们是animate动画鸭</h6>
		
	</body>
</html>

 

2、修改

如果需要修改,比如动画时间,官网也为我们提供了方法,修改属性值即可。

例如:我需要将第一个盒子动画时间为3s,只需要在css中找到对应的类,重写animation-duration: 3s;这个语句即可。

或者我需要动画在1s后执行,重写animation-delay: 1s;这个语句即可

本次这个插件的使用方法就讲到这,许多功能都需要自己去看文档然后操作就会发现他的效果。 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值