记录几种常用的弹出层动画样式效果

记录几种常用的弹出层动画样式效果

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /*弹层动画(从上往下)*/
        .fadeInDown {
            -webkit-animation: fadeInDown .3s;
            animation: fadeInDown .3s;
        }

        @keyframes fadeInDown {
            0% {
                -webkit-transform: translate3d(0, -20%, 0);
                -webkit-transform: translate3d(0, -20%, 0);
                transform: translate3d(0, -20%, 0);
                transform: translate3d(0, -20%, 0);
                opacity: 0;
            }

            100% {
                -webkit-transform: none;
                transform: none;
                opacity: 1;
            }
        }

        @-webkit-keyframes fadeInDown {
            0% {
                -webkit-transform: translate3d(0, -20%, 0);
                opacity: 0;
            }

            100% {
                -webkit-transform: none;
                opacity: 1;
            }
        }

        /*弹层动画(从下往上)*/
        .fadeInUp {
            -webkit-animation: fadeInUp .4s;
            animation: fadeInUp .4s;
        }

        @keyframes fadeInUp {
            0% {
                -webkit-transform: translate3d(0, 100%, 0);
                -webkit-transform: translate3d(0, 100%, 0);
                transform: translate3d(0, 100%, 0);
                transform: translate3d(0, 100%, 0);
            }

            100% {
                -webkit-transform: none;
                transform: none;
            }
        }

        @-webkit-keyframes fadeInUp {
            0% {
                -webkit-transform: translate3d(0, 100%, 0);
            }

            100% {
                -webkit-transform: none;
            }
        }

        .fadeInLeft {
            -webkit-animation: fadeInLeft .4s;
            animation: fadeInLeft .4s;
        }

        /*弹层动画(从右往左)*/
        @keyframes fadeInLeft {
            0% {
                -webkit-transform: translate3d(100%, 0, 0);
                -webkit-transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
            }

            100% {
                -webkit-transform: none;
                transform: none;
            }
        }

        @-webkit-keyframes fadeInLeft {
            0% {
                -webkit-transform: translate3d(100%, 0, 0);
            }

            100% {
                -webkit-transform: none;
            }
        }

        /*弹层动画(放大渐入)*/
        .popIn {
            -webkit-animation: fadeleftIn .4s;
            animation: fadeleftIn .4s;
            -webkit-animation-name: popIn;
            animation-name: popIn;
        }

        @-webkit-keyframes popIn {
            0% {
                -webkit-transform: scale3d(0, 0, 0);
                transform: scale3d(0.5, 0.5, 0.5);
                opacity: 0;
            }

            50% {
                -webkit-animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
                animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
            }

            100% {
                -webkit-transform: scale3d(1, 1, 1);
                transform: scale3d(1, 1, 1);
                -webkit-animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                opacity: 1;
            }
        }

        @keyframes popIn {
            0% {
                -webkit-transform: scale3d(0, 0, 0);
                transform: scale3d(0.5, 0.5, 0.5);
                opacity: 0;
            }

            50% {
                -webkit-animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
                animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
            }

            100% {
                -webkit-transform: scale3d(1, 1, 1);
                transform: scale3d(1, 1, 1);
                -webkit-animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                opacity: 1;
            }
        }

        /*弹层动画(缩小渐出)*/
        .popOut {
            -webkit-animation: popOut .4s;
            animation: popOut .4s;
        }

        @-webkit-keyframes popOut {
            0% {
                -webkit-transform: scale3d(1, 1, 1);
                transform: scale3d(1, 1, 1);
                -webkit-animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                opacity: 1;
            }

            50% {
                -webkit-animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
                animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
            }

            100% {
                -webkit-transform: scale3d(0, 0, 0);
                transform: scale3d(0.5, 0.5, 0.5);
                opacity: 0;
            }
        }

        @keyframes popOut {
            0% {
                -webkit-transform: scale3d(1, 1, 1);
                transform: scale3d(1, 1, 1);
                -webkit-animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                opacity: 1;
            }

            50% {
                -webkit-animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
                animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
            }

            100% {
                -webkit-transform: scale3d(0, 0, 0);
                transform: scale3d(0.5, 0.5, 0.5);
                opacity: 0;
            }
        }

        .black {
            background-color: #000;
            width: 100px;
            height: 100px;
        }
    </style>
</head>

<body>
    <div class="black popOut"></div>
</body>

</html>

以上这篇记录几种常用的弹出层动画样式效果就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持芦苇派。

原创文章,作者:ECHO陈文,如若转载,请注明出处:https://www.luweipai.cn/html/1694663449/

  • 1