css 动画学习

animation: name duration timing-function delay iteration-count direction fill-mode play-state;
参数说明:
name要绑定到选择器的关键帧的名称
duration :动画在多少时间内完成
timing-function:动画播放速度
animation-timing使用的数学函数,称为三次贝塞尔曲线,速度曲线。使用此函数,您可以使用您自己的值,或使用预先定义的值之一:
描述
linear动画从头到尾的速度是相同的。
ease默认。动画以低速开始,然后加快,在结束前变慢。
ease-in动画以低速开始。
ease-out动画以低速结束。
ease-in-out动画以低速开始和结束。
cubic-bezier(n,n,n,n)在 cubic-bezier 函数中自己的值。可能的值是从 0 到 1 的数值。

 delay: 等待 ,然后开始动画:

iteration-count :动画执行次数

描述
n一个数字,定义应该播放多少次动画
infinite指定动画应该播放无限次(永远)

direction :动画执行顺序

实例:

<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			.circle {
				border: 2px solid #aaa;
				border-radius: 100%;
				width: 25px;
				height: 25px;
				border-top-color: transparent;
				animation: circle infinite 0.75s linear;				
			}
			
			@keyframes circle {
				0% {
					transform: rotate(0deg);
					 
				}
				100% {
					transform: rotate(360deg);
				}
			}
 			.circle4{
 				width: 200px;
 				height: 100px; 				 
 				display: flex; 				
 			}
 			.circle4 p{
 				width: 8px;
 				height: 8px;
 				border-radius: 50%;
 				margin-left:5px;
 				background-color: lightseagreen;  
 				/*执行的动画规则是myThress 0.8s内完成动画  动画以低速开始和结束  永久执行下去*/				 
 				animation: myThree 0.8s ease-in-out alternate infinite; 				
 			}
 			.circle4 p:nth-of-type(1) {
			  animation-delay: -0.4s;
			}		
			.circle4 p:nth-of-type(2) {
			  animation-delay: -0.2s;
			}
	 		@keyframes myThree{
	 			 0%{
	 			 	 opacity: 1;
	 			 }
	 			 100%{	 			 	 
	 			 	 
	 			 opacity: 0;
	 			 }
	 		}
		</style>
	</head>

	<body>
		<div class="circle"></div>		 
		<div class="circle4">
			<p class="p1"></p>
			<p class="p2"></p>
			<p class="p3"></p>
		</div>
	</body>

</html>

效果:

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值