css animation
TRANSCRIPT
CSS3 2D Transforms
CSS3 transforms allow you to translate, rotate, scale, and skew elements
http://www.w3schools.com/css
Example
translate
div { width: 300px; height: 100px; background-color: yellow; border: 1px solid black; -ms-transform: translate(50px,100px); /* IE 9 */ -webkit-transform: translate(50px,100px); /* Safari */ transform: translate(50px,100px); /* Standard syntax */}(0,0)
http://www.w3schools.com/css
Example
rotate
div { width: 300px; height: 100px; background-color: yellow; border: 1px solid black;}
div#myDiv { -ms-transform: rotate(20deg); /* IE 9 */ -webkit-transform: rotate(20deg); /* Safari */ transform: rotate(20deg); /* Standard syntax */}
http://www.w3schools.com/css
A easy animation
example
• Just add “transition” in your CSS style
div { width: 300px; height: 100px; background-color: yellow; border: 1px solid black;-webkit-transition: transform 1s; /* Safari */ transition: transform 1s; }div:hover{ -ms-transform: translate(50px,100px); /* IE 9 */ -webkit-transform: translate(50px,100px); /* Safari */ transform: translate(50px,100px); /* Standard syntax */}
http://www.w3schools.com/css
CSS3 Transitions
To create a transition effect, you must specify two things:
• The CSS property you want to add an effect to
• The duration of the effect
-webkit-transition: transform 1s; /* Safari */ transition: transform 1s;
Previously example
http://www.w3schools.com/css
Effect propertyEffect duration
CSS3 Animations
• You specify CSS styles inside the @keyframes rule, the animation will gradually change from the current style to the new style at certain times/* The animation code */@keyframes example { from {background-color: red;} to {background-color: yellow;}}
/* The element to apply the animation to */div { width: 100px; height: 100px; background-color: red; animation-name: example; animation-duration: 4s;}
http://www.w3schools.com/css
You can specify
every frame
/* The animation code */@keyframes example { 0% {background-color: red; left:0px; top:0px;} 25% {background-color: yellow; left:200px; top:0px;} 50% {background-color: blue; left:200px; top:200px;} 75% {background-color: green; left:0px; top:200px;} 100% {background-color: red; left:0px; top:0px;}}
/* The element to apply the animation to */div { width: 100px; height: 100px; position: relative; background-color: red; animation-name: example; animation-duration: 4s;} http://www.w3schools.com/css
Just choose one of your love
http://tinyurl.com/p35wuvx http://tinyurl.com/qhkmbr3 http://tinyurl.com/nhkkxa4