Advertisement

火箭升空特效

阅读量:

html代码

复制代码
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>火箭升空特效</title>
    <link rel="stylesheet" href="index.css">
    <script src="./index.js"></script>
    </head>
    
    <body>
    <div class="Box">
        <div class="rocket"><img src="./火箭.png" alt=""></div>
    </div>
    
    </body>
    
    </html>

css文件

复制代码
    *{
    margin:0;
    padding:0;
    }
    body{
    background-color: #262a31;
    }
    .Box{
    display: flex;
    height: 90vh;
    align-items: center;
    justify-content: center;
    }
    .Box img{
    width: 110px;
    }
    
    .Box .rocket{
    position: relative;
    animation: shake 0.5s linear infinite;
    }
    .Box .rocket::after {
    content: "";
    position: absolute;
    left:50%;
    bottom: -90%;
    height: 120px;
    width: 20px;
    transform: translateX(-50%);
    background:linear-gradient( rgb(245, 72, 72), transparent);
    border-radius: 2px 2px 0 0;
    }
    @keyframes shake{
    0%,100%{
        transform:translateY(-2px);
    }
    
    50%{
        transform: translateY(2px);
    }
    }
    
    .Box i{
    position: absolute;
    height:20px;
    width: 1px;
    top: 10px;
    left: 20px;
    background: #fff;
    animation: line 2s linear infinite;
    }
    
    @keyframes line{
    from{
        transform: translateY(0);
    }
    to{
        transform: translateY(80vh);
    }
    }

预览地址

全部评论 (0)

还没有任何评论哟~