Detailed CSS3animation property (b)
animation-iteration-count
animation-iteration-count property
The number of cycles to retrieve or set the object animation
grammar
animation-iteration-count: infinite | <number>;
Parameter Description
<Number> is a number whose default value is "1"; infinite infinite number of cycles
Programming Exercises
We learned knowledge of animation, then we accomplished together Tai Chi diagram of a rotating bar.
task
- Create a div, use CSS to control its size, borders, location, etc., made of a static circle, usually red, usually white
- Draw two rings pseudo div element and placing a suitable location makes Tai Chi pattern
- Creating animations
- Repeat property defines the animation, let loop
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CSS3animation属性详解(二)</title>
<style type="text/css">
div{
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
box-sizing: border-box;
width: 400px;
height: 400px;
margin: auto;
border: 1px solid red;
border-bottom: 200px solid red;
border-radius: 50%;
transform-origin: 50% 50%;
animation-name: rotate;
animation-duration: 5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
div:before{
content: "";
float: left;
width: 50px;
height: 50px;
border: 75px solid red;
background-color: white;
margin-top: 100px;
border-radius: 50%;
}
div:after{
content: "";
float: right;
width: 50px;
height: 50px;
border: 75px solid white;
background-color: red;
margin-top: -200px;
border-radius: 50%;
}
@keyframes rotate{
from{transform: rotate(0deg);}
to{transform: rotate(360deg);}
}
</style>
</head>
<body>
<div></div>
</body>
</html>