Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example of CSS3 transform Property Animation</title> <style> .container{ margin: 25px; } .container img{ -webkit-animation: test 4s infinite; /* Chrome, Safari, Opera */ animation: test 4s infinite; /* Standard syntax */ } /* Chrome, Safari, Opera */ @-webkit-keyframes test { 50% {-webkit-transform: rotate(360deg);} } /* Standard syntax */ @keyframes test { 50% {transform: rotate(360deg);} } /* Example of 3D Transform */ .container-3d{ margin: 25px; width: 125px; height: 125px; perspective: 300px; border: 4px solid #a2b058; background: #f0f5d8; } .container-3d img{ /* Chrome, Safari, Opera */ -webkit-animation: test3d 4s infinite; -webkit-transform-origin: right center 0; /* Standard syntax */ animation: test3d 4s infinite; transform-origin: right center 0; } /* Chrome, Safari, Opera */ @-webkit-keyframes test3d { 50% { -webkit-transform: rotate3d(0, 1, 0, 180deg); /* Chrome, Safari, Opera */ } } /* Standard syntax */ @keyframes test3d { 50% { transform: rotate3d(0, 1, 0, 180deg); /* Standard syntax */ } } </style> </head> <body> <p><strong>Warning:</strong> CSS Animations do not work in Internet Explorer 9 and earlier versions.</p> <p><strong>Note:</strong> The "star fish" image is rotating form its original position to 360 degree clockwise, and back to the original position again up to infinite times.<p> <div class="container"> <img src="/examples/images/star-fish.png" alt="Star Fish"> </div> <hr> <p><strong>Note:</strong> The "club card" image is rotating 180 degree in 3D space along the Y-axis (i.e. right edge), and back to the original position again up to infinite times.<p> <div class="container-3d"> <img src="/examples/images/club.jpg" alt="Club Card"> </div> </body> </html>