css3 边框圆角跳动的心

2019-05-04  本文已影响0人  562843cce5ff

跳动的心

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            background-color: pink;
        }
        .wrap {
            width: 450px;
            height: 400px;
            margin: 0 auto;
            margin-top: 100px;
            position: relative;
            animation: sport 1s ease-in 0s infinite alternate;
        }

        @keyframes sport {
            from {
                width: 450px;
                height: 400px;
            }
            to {
                width: 500px;
                height: 450px;
            }
        }

        .left, .right {
            width: 250px;
            height: 250px;
            background-color: red;
            border-radius: 50%;
            position: absolute;
            box-sizing: border-box;
            animation: move 1s ease-in 0s infinite alternate;
        }

        .left {
            left: 0;
            top: 0;
            z-index: 999;
            box-shadow: -10px -5px 40px 10px red;
        }

        .right {
            right: 0;
            top: 0;
            box-shadow: 10px -5px 40px 10px red;
        }

        .bottom {
            width: 250px;
            height: 250px;
            background-color: red;
            position: absolute;
            left: 50%;
            transform: translateX(-50%) rotateZ(45deg);
            bottom: 50px;
            box-shadow: 0px 0px 30px 10px red;
            animation: move 1s ease-in 0s infinite alternate;
        }

        @keyframes move {
            from {
                width: 250px;
                height: 250px;
            }
            to {
                width: 300px;
                height: 300px;
            }
        }
    </style>

</head>
<body>
<div class="wrap">
    <div class="left"></div>
    <div class="right"></div>
    <div class="bottom"></div>
</div>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读