CSS animation example 3: Dancing man

CSS-animation-example-dancing-manDancing man animation can be created by using following code.

dancing-man

<html>
<head>
<style>
div#container
{
position:relative;
left:0px;
top:100px;
-webkit-animation: dance 1s linear infinite alternate;
animation: dance 1s linear infinite alternate;
}
div#circle
{
height:100px;
width:100px;
background-color:orange;
border-radius:50%;
position:absolute;
left:200px;
top:100px;
}
div#square
{
height:170px;
width:170px;
background-color:orange;
border-radius:10%;
position:absolute;
left:170px;
top:200px;
}
div#leg1
{
height:170px;
width:55px;
background-color:orange;
border-radius:10%;
position:relative;
left:170px;
top:350px;
}
div#leg2
{
height:170px;
width:55px;
background-color:orange;
border-radius:10%;
position:absolute;
left:285px;
top:350px;
}
div#hand1
{
height:280px;
width:55px;
background-color:orange;
border-radius:10%;
-webkit-transform:rotate(-45deg);
transform:rotate(-45deg);
position:absolute;
left:150px;
top:100px;
-webkit-animation:handdance1 1s linear infinite alternate;
animation:handdance1 1s linear infinite alternate;
}
div#hand2
{
height:280px;
width:55px;
background-color:orange;
border-radius:10%;
-webkit-transform:rotate(45deg);
transform:rotate(45deg);
position:absolute;
left:300px;
top:100px;
-webkit-animation:handdance2 1s linear infinite alternate;
animation:handdance2 1s linear infinite alternate;
}
@-webkit-keyframes dance
{
0%{position:relative;left:0px;top:100px;}
50%{position:relative;left:100px;top:0px;}
100%{position:relative;left:200px;top:100px;}
}
@-webkit-keyframes handdance1
{
0%{-webkit-transform:rotate(-10deg);}
50%{-webkit-transform:rotate(-45deg);}
100%{-webkit-transform:rotate(-10deg);}
}
@-webkit-keyframes handdance2
{
0%{-webkit-transform:rotate(10deg);}
50%{-webkit-transform:rotate(45deg);}
100%{-webkit-transform:rotate(10deg);}
}
@keyframes dance
{
0%{position:relative;left:0px;top:100px;}
50%{position:relative;left:100px;top:0px;}
100%{position:relative;left:200px;top:100px;}
}
@keyframes handdance1
{
0%{-webkit-transform:rotate(-10deg);}
50%{-webkit-transform:rotate(-45deg);}
100%{-webkit-transform:rotate(-10deg);}
}
@keyframes handdance2
{
0%{-webkit-transform:rotate(10deg);}
50%{-webkit-transform:rotate(45deg);}
100%{-webkit-transform:rotate(10deg);}
}
</style>
</head>

<body>
<div id=”container”>
<div id=”circle”></div>
<div id=”square”></div>
<div id=”leg1″></div>
<div id=”leg2″></div>
<div id=”hand1″></div>
<div id=”hand2″></div>
</div>
</body>
</html>

Comments

comments