CSS - Rotate In Effect



Description

It provides to move or cause to move in a circle round an axis or centre.

Syntax

@keyframes rotateIn { 0% { transform-origin: center center; transform: rotate(-200deg); opacity: 0; } 100% { transform-origin: center center; transform: rotate(0); opacity: 1; } }

Parameters

  • Transform − Transform applies to 2d and 3d transformation to an element.

  • Opacity − Opacity applies to an element to make translucence.

Example

<html> <head> <style> .riAnimated { background-image: url(/html/images/test.png); background-repeat: no-repeat; background-position: left top; padding-top: 120px; margin-bottom: 60px; margin-top: 80px; -webkit-animation-duration: 3s; animation-duration: 3s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } @-webkit-keyframes rotateIn { 0% { -webkit-transform-origin: center center; -webkit-transform: rotate(-180deg); opacity: 0; } 100% { -webkit-transform-origin: center center; -webkit-transform: rotate(0); opacity: 1; } } @keyframes rotateIn { 0% { transform-origin: center center; transform: rotate(-180deg); opacity: 0; } 100% { transform-origin: center center; transform: rotate(0); opacity: 1; } } .rotateIn { -webkit-animation-name: rotateIn; animation-name: rotateIn; } </style> </head> <body> <div id="riAnimates" class="riAnimated"></div> <button onclick="riFun()">Click</button> <script> function riFun() { document.getElementById("riAnimates").classList.add('rotateIn'); } </script> </body> </html>

Output

It will produce the following result:

Rotate In Effect
css_animation.htm
Advertisements