Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Animation
- And finally just for Safari users or Firefox 4 beta users we have transitions. Transitions include rotation, easing in and out of elements and the ability to specify how many times they do this... and much more!
- A simple example might include changing the hover effect of a link so the colour changes smoothly from one colour to another.
- Both Safari and Firefox 4 support this functionality consistenly.
- First define a link colour:
- .box a {
- color: #0f0;
- }
- Set a colour and the property to animate using the transition-property:
- #box10 a:hover {
- color: #0f0;
- -moz-transition-property: color;
- -webkit-transition-property: color;
- }
- How long should the animation last:
- #box10 a:hover {
- color: #0f0;
- -moz-transition-property: color;
- -webkit-transition-property: color;
- -moz-transition-duration: 0.5s;
- -webkit-transition-duration: 0.5s;
- }
- What animation type should be used (including ease, linear, ease-in, ease-out and more!):
- Links can be made to have subtle transitions using the transition CSS commands
- #box10 a:hover {
- color:#31801f;
- -moz-transition-property: color;
- -webkit-transition-property: color;
- -moz-transition-duration: 0.5s;
- -webkit-transition-duration: 0.5s;
- -moz-transition-timing-function: ease;
- -webkit-transition-timing-function: ease;
- }
- There are many more ways to animate elements and the CSS3 transition working draft outlines these in great detail.
Add Comment
Please, Sign In to add comment