前端

CSS动画

2019-03-25  本文已影响0人  吴宪峰
image.png
<!DOCTYPE html>
<html>

<head>
    <title>watch</title>
</head>

<body>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div>
        <img src="logo.png">
    </div>
    <style>
        body {
            margin: 0;
            padding: 0;
            overflow: hidden;
            background: #607d89;
        }
        
        div {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0);
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            border-radius: 50%;
            box-shadow: inset 0 50px 150px rgba(0, 0, 0, 1);
            border-bottom: 1px solid #fff;
            animation: animate 1s ease-in-out forwards;
        }
        
        @keyframes animate {
            0% {
                transform: translate(-50%, -50%) scale(0);
            }
            100% {
                transform: translate(-50%, -50%) scale(1);
            }
        }
        
        div:nth-child(1) {
            width: 1500px;
            height: 1500px;
            animation-delay: 0s;
        }
        
        div:nth-child(2) {
            width: 1250px;
            height: 1250px;
            animation-delay: 0.5s;
        }
        
        div:nth-child(3) {
            width: 1000px;
            height: 1000px;
            animation-delay: 1s;
        }
        
        div:nth-child(4) {
            width: 750px;
            height: 750px;
            animation-delay: 1.5s;
        }
        
        div:nth-child(5) {
            width: 500px;
            height: 500px;
            animation-delay: 2s;
        }
        
        div:nth-child(5) img {
            max-width: 250px;
            z-index: -1;
            transform: translateY(500px);
            animation: animateLogo 1s ease-in-out forwards;
            animation-delay: 3s;
        }
        
        @keyframes animateLogo {
            0% {
                transform: translateY(500px);
            }
            100% {
                transform: translateY(0px);
            }
        }
    </style>
</body>

</html>
上一篇 下一篇

猜你喜欢

热点阅读