css动画逐帧播放、缩放

百度直接搜索:animation.css 库,专门是写好的css动画库

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/animation.css"/>
	    <style type="text/css">
	    	section{
				width: 300px;
				height: 200px;
				background: orange;
			}
			section:hover{
				animation: rubberBand;
			}
	    </style>
	</head>
	<body>
		<section></section>
	</body>
</html>

 

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
			}
			section{
				width: 180px;
				height: 300px;
				background: url(img/cs.png) no-repeat;
				margin: 100px auto;
				/* step-start没有过度,每次跳到关键帧 */
				animation: runImg 0.6s step-start infinite;
			}
			@keyframes runImg{
				0%{
					background-position: 0 0;
				}
				14.3{
					background-position: -180px 0;
				}
				28.6%{
					background-position: -360px 0;
				}
				42.9%{
					background-position: -540px 0;
				}
				57.2%{
					background-position: -720px 0;
				}
				71.5%{
					background-position: -900px 0;
				}
				85.8%{
					background-position: -1080px 0;
				}
				100%{
					background-position: 0 0;
				}
			}
		</style>
	</head>
	<body>
		<section>
			
		</section>
	</body>
</html>

 缩放:小例子

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
			}
			section{
				width: 100px;
				height: 100px;
				background: #ccc;
				margin: 100px auto;
				position: relative;
				}
			div{
				width: 80px;
				height: 80px;
				border: 3px solid red;
				position: absolute;
				border-radius: 50px;
				transform: scale(0);
				opacity: 0;
			}
			div:nth-child(1){
				animation: scaleDiv 5s linear infinite;
			}
			/* 名称、播放时长、延迟、动画播放属性、循环永久 */
			div:nth-child(2){
				animation: scaleDiv 5s 1s linear infinite;
			}
			div:nth-child(3){
				animation: scaleDiv 5s 2s linear infinite;
			}
			div:nth-child(4){
				animation: scaleDiv 5s 3s linear infinite;
			}
			div:nth-child(5){
				animation: scaleDiv 5s 4s linear infinite;
			}
			@keyframes scaleDiv{
				0%{
					transform: scale(0);
					opacity: 0;
				}
				25%{
					transform: scale(0.5);
					opacity: 0.5;
				}
				50%{
					transform: scale(1);
					opacity: 0.5;
				}
				70%{
					transform: scale(1.5);
					opacity: 0.5;
				}
				100%{
					transform: scale(2);
					opacity: 0;
				}
			}
		</style>
	</head>
	<body>
		<section>
			<div></div>
			<div></div>
			<div></div>
			<div></div>
			<div></div>
		</section>
	</body>
</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值