CSS - Bounce Out Left Effect



Description

Bounce Animation effect is used to move the element quick up, back, or away from a surface after hitting it.

Syntax

@keyframes bounceOutLeft {
   0% {
      transform: translateX(0);
   }
   20% {
      opacity: 1;
      transform: translateX(20px);
   }
   100% {
      opacity: 0;
      transform: translateX(-2000px);
   }
} 

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>
        .bolAnimated {
            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;
            -webkit-animation-duration: 2s;
            animation-duration: 2s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
        }

        @-webkit-keyframes bounceOutLeft {
            0% {
                -webkit-transform: translateX(40px);
            }

            20% {
                opacity: 1;
                -webkit-transform: translateX(80px);
            }

            100% {
                opacity: 0;
                -webkit-transform: translateX(-20px);
            }
        }

        @keyframes bounceOutLeft {
            0% {
                transform: translateX(40px);
            }

            20% {
                opacity: 1;
                transform: translateX(80px);
            }

            100% {
                opacity: 0;
                transform: translateX(-20px);
            }
        }

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

<body>
    <div id="bolAnimates" class="bolAnimated"></div>
    <button onclick="bolFun()">Click</button>
    <script>
        function bolFun() {
            document.getElementById("bolAnimates").classList.add('bounceOutLeft');
        }
    </script>
</body>

</html>

Output

It will produce the following result:

Bounce Out Left Effect
css_animation.htm
h3
Advertisements