动画多状态写法2

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		.box {
			/* infinite 无限循环
			alternate 逆播  */
			animation: changes 3s infinite alternate;
		}
		/* 百分比是相对动画时长 */
		@keyframes changes {
			0% {
				width: 100px;
				height: 100px;
				background-color: red;
			}
			30% {
				width: 200px;
				height: 400px;
				background-color: blue;
			}
			60% {
				width: 300px;
				height: 600px;
				background-color: skyblue;
			}
			100% {
				width: 600px;
				height: 800px;
				background-color: #ccc;
			}
		}
	</style>
</head>

<body>
	<div class="box"></div>
</body>

</html>

posted @ 2019-09-26 04:04  193557749  阅读(130)  评论(0编辑  收藏  举报