Before you do this, you need to know about the transform properties of CSS first.
The Transform property applies a 2D or 3D conversion to an element. This property allows us to rotate, scale, move, or skew elements.
Look
When you turn it on automatically, when the mouse passes the speed of rotation, the mouse moves away to restore the original speed.
Reference code: (For the sake of beauty can be added to the background of the picture, I here is blank background appears monotonous)
<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "UTF-8"> <title>Animation</title> <Linkrel= "stylesheet"type= "Text/css"href= "Css/animate1.css"/> </Head> <Body> <Div></Div> <DivID= "One"> <Divclass= "SJ"> </Div> <Divclass= "Ye"> </Div> <Divclass= "Ye1"> </Div> <Divclass= "Re"> </Div> <Divclass= "Blue"> </Div> <Divclass= "Blue1"> </Div> <Divclass= "Green"> </Div> <Divclass= "Green1"> </Div> </Div> <DivID= "mg"> </Div> <Div> <!-- - </Div> </Body></HTML>
CSS: (There are more simple ways to draw this windmill, I am a bit more complicated here, more cumbersome, not concise)
*{margin:0;padding:0;}#s{float: Left;}#one: Hover{Animation:run 0.6s linear infinite; }@keyframes Run{from{Transform:Rotate (360deg); } to{Transform:Rotate (0deg); }}. SJ{Margin-top:5px;Transform:Rotate ( -46deg);position:Absolute;Top:14px; Left:-49px;float: Left;width:0;Height:0;Z-index:2;Border:50px Solid Lightcoral;Border-color:lightcoral Transparent Transparent transparent;}. Ye{Transform:Rotate (0deg);position:Absolute; Left:0px;Top:5px Float:left;width:0;Height:0;Border:80px Solid #D9B300;Z-index:2;Border-color:transparent transparent transparent #D9B300;}. Ye1{Transform:Rotate (0deg);position:Absolute; Left:-80px;Top:78px;float: Left;width:0;Height:0;Z-index:2;Border:80px Solid Orange;Border-color:transparent orange transparent transparent;}. Re{Transform:Rotate ( -46deg);position:Absolute; Left:21px;Top:-61px;float: Left;Z-index:2;width:0;Height:0;Border:59px Solid Brown;Border-color:transparent transparent transparent brown;}. Blue{Transform:Rotate (0deg);position:Absolute; Left:80px;Top:-79px;float: Left;width:0;Height:0;Z-index:2;Border:80px Solid Cornflowerblue;Border-color:transparent transparent transparent cornflowerblue;}. Blue1{Transform:Rotate ( -44deg);position:Absolute; Left:102px;Top:23px;float: Left;width:0;Height:0;Z-index:2;Border:58px Solid LightBlue;Border-color:lightblue Transparent Transparent transparent;Animation:gg 1s linear infinite; }. Green{Transform:Rotate (0deg);position:Absolute; Left:80px;Top:80px;Z-index:2;float: Left;width:0;Height:0;Border:81px Solid #01814A;Border-color:#01814A Transparent Transparent transparent;Z-index:2; }. Green1{Transform:Rotate ( -45deg);position:Absolute;Top:103px; Left:23px;float: Left;width:0;Height:0;Border:57px Solid Seagreen;Border-color:transparent Seagreen Transparent transparent;Z-index:2;}#mg{background:Salmon;width:15px;Height:300px;Border-radius:8px;position:Absolute;Top:220px; Left:680px;Z-index:0;}#one{margin:150px Auto Auto Auto;width:162px;Transform:Rotate ( -45deg);Height:162px;Line-height:168px;text-align:Center;position:relative;Z-index:3;Animation:Run 9s linear infinite; }#img{position:relative;Top:-50px; Left:522px;Z-index:-1;}
View Code
CSS to make rotating windmill (transform article)