【CSS小动画】会跳动的小心心

效果图如下:

在这里插入图片描述
完整的源码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>爱心</title>
    <style>
        .wrap{
            width:150px;
            height: 250px;
            background-color: red;
            border-radius: 200px 160px 0px 0px ;
            transform-origin: center;
            transform: rotate(45deg);
            margin:0 auto;
            margin-top:100px;
            box-shadow: 0px 0px 100px red; 
        }
        .wrap1{
            width: 500px;
            height: 500px;
            margin:0 auto;
            /* box-shadow: 0px 0px 100px red;  */
            animation: ax 1s infinite alternate;
            transform:scale(.5);

        }
        @keyframes ax{
            0%{}
            100%{transform:scale(1.2);}
        }
        .box{
            transform-origin: center;
            width:150px;
            height: 250px;
            background-color: red;
            border-radius: 160px 200px 0px 0px;
            position: absolute;
            top:2%;
            left:95px;
            transform: rotate(-45deg);
            box-shadow: 0px 0px 100px red; 
        }
    </style>
</head>
<body>
    <div class="wrap1">
        <div class="wrap"></div>
        <div class="box"></div>
    </div>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_42554191/article/details/106165738