CSS - Rotate Out Effect



Description

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

Syntax

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

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>
        .roAnimated {
            background-image: url(/https/www.tutorialspoint.com/html/images/test.png);
            background-repeat: no-repeat;
            background-position: left top;
            padding-top: 95px;
            margin-bottom: 60px;
            margin-top: 200px;
            -webkit-animation-duration: 3s;
            animation-duration: 3s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
        }




        @-webkit-keyframes rotateOut {
            0% {
                -webkit-transform-origin: center center;
                -webkit-transform: rotate(0);
                opacity: 1;
            }

            100% {
                -webkit-transform-origin: center center;
                -webkit-transform: rotate(180deg);
                opacity: 0;
            }
        }

        @keyframes rotateOut {
            0% {
                transform-origin: center center;
                transform: rotate(0);
                opacity: 1;
            }

            100% {
                transform-origin: center center;
                transform: rotate(180deg);
                opacity: 0;
            }
        }

        .rotateOut {
            -webkit-animation-name: rotateOut;
            animation-name: rotateOut;
        }
    </style>
    </head>

<body>
    <div id="roAnimates" class="roAnimated"></div>
    <button onclick="roFun()">Click</button>

    <script>
        function roFun() {
            document.getElementById("roAnimates").classList.add('rotateOut');
        }
    </script>
</body>

</html>

Output

It will produce the following result:

Rotate Out Effect
css_animation.htm
Advertisements