<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>11、动画效果(animation)</title>
<style>
/* keyframe定义一个动画 */
@keyframes anim {
/* from */
0% {
transform: rotate(0deg);
}
50% {
transform: rotate(360deg) scale(2);
background-color: bisque;
}
/* to */
100% {
transform: rotate(0deg);
background-color: blanchedalmond;
}
}
/*
animation:动画名称、动画时间、速度、延迟、次数
animation-name: 规定需要绑定到选择器的keyframe名称;
animation-duration: 规定完成动画所花费的时间;
animation-timing-function: 规定动画的速度曲线;
animation-delay: 规定在动画开始之前的延迟;
animation-iteration-count: 规定动画播放次数;
*/
.box {
width: 100px;
height: 100px;
background-color: antiquewhite;
margin: 200px auto;
animation: anim 3s infinite;
}
</style>
</head>
<body>
</body>
<div class="box"></div>
</html>