CSS - Flip Out Y-Axis Effect



Description

An Element can turn over or cause to turn over with a sudden quick movement.

Syntax

@keyframes flipOutY {
   0% {
      transform: perspective(400px) rotateY(0deg);
      opacity: 1;
   }
   100% {
      transform: perspective(400px) rotateY(90deg);
      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>
        .foyAnimated {
            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-left: 80px;
            margin-top: 60px;
            margin-right: 80px;
            -webkit-animation-duration: 3s;
            animation-duration: 3s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
        }



        @-webkit-keyframes flipOutY {
            0% {
                -webkit-transform: perspective(400px) rotateY(0deg);
                opacity: 1;
            }

            100% {
                -webkit-transform: perspective(400px) rotateY(180deg);
                opacity: 0;
            }
        }

        @keyframes flipOutY {
            0% {
                transform: perspective(400px) rotateY(0deg);
                opacity: 1;
            }

            100% {
                transform: perspective(400px) rotateY(180deg);
                opacity: 0;
            }
        }

        .flipOutY {
            -webkit-backface-visibility: visible !important;
            -webkit-animation-name: flipOutY;
            backface-visibility: visible !important;
            animation-name: flipOutY;
        }
    </style>
</head>

<body>
    <div id="foyAnimates" class="foyAnimated"></div>
    <button onclick="foyFun()">Click</button>

    <script>
        function foyFun() {
            document.getElementById("foyAnimates").classList.add('flipOutY');
        }
    </script>
</body>

</html>

Output

It will produce the following result:

Flip Out Y-Axis Effect
css_animation.htm
Advertisements