Guest User

Untitled

a guest
Sep 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Animation
  2. 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!
  3.  
  4. A simple example might include changing the hover effect of a link so the colour changes smoothly from one colour to another.
  5.  
  6. Both Safari and Firefox 4 support this functionality consistenly.
  7.  
  8. First define a link colour:
  9.  
  10. .box a {
  11. color: #0f0;
  12. }
  13.  
  14. Set a colour and the property to animate using the transition-property:
  15.  
  16. #box10 a:hover {
  17. color: #0f0;
  18. -moz-transition-property: color;
  19. -webkit-transition-property: color;
  20. }
  21.  
  22. How long should the animation last:
  23.  
  24. #box10 a:hover {
  25. color: #0f0;
  26. -moz-transition-property: color;
  27. -webkit-transition-property: color;
  28. -moz-transition-duration: 0.5s;
  29. -webkit-transition-duration: 0.5s;
  30. }
  31.  
  32. What animation type should be used (including ease, linear, ease-in, ease-out and more!):
  33.  
  34. Links can be made to have subtle transitions using the transition CSS commands
  35.  
  36. #box10 a:hover {
  37. color:#31801f;
  38. -moz-transition-property: color;
  39. -webkit-transition-property: color;
  40. -moz-transition-duration: 0.5s;
  41. -webkit-transition-duration: 0.5s;
  42. -moz-transition-timing-function: ease;
  43. -webkit-transition-timing-function: ease;
  44. }
  45.  
  46. 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