svg+canvas实现火山口喷发喷射火山灰云朵动画代码

代码语言:html

所属分类:动画

代码描述:svg+canvas实现火山口喷发喷射火山灰云朵动画代码

代码标签: svg canvas 火山 喷发 动画 云朵

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

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

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">




    <style>
        html, body {
          height: 100%;
          overflow: hidden;
          background-color: #189BBB;
        }
        
        canvas {
          display: block;
          background: transparent;
          position: relative;
          z-index: 1;
        }
        
        .volcano {
          position: absolute;
          bottom: 0;
          left: 50%;
          transform: translateX(-50%) translateY(20%);
          height: 40vh;
          z-index: 0;
        }
        
        .volcano-front {
          z-index: 2;
        }
        
        .volcano svg {
          display: block;
          width: auto;
          height: 100%;
          position: relative;
          z-index: 0;
        }
        
        @-webkit-keyframes cloud {
          from {
            transform: translateX(-100vw);
          }
          from {
            transform: translateX(100vw);
          }
        }
        
        @keyframes cloud {
          from {
            transform: translateX(-100vw);
          }
          from {
            transform: translateX(100vw);
          }
        }
        .cloud {
          position: absolute;
          top: 10px;
          left: 0;
          width: 100px;
          transform: translateX(-100vw);
          -webkit-animation: cloud 10s linear infinite alternate;
                  animation: cloud 10s linear infinite alternate;
          z-index: 0;
        }
        
        .cloud svg {
          width: 100%;
        }
        
        .cloud-1 {
          top: 70px;
          width: 120px;
          animation: cloud 16s linear infinite reverse;
        }
        
        .cloud-2 {
          top: 60px;
          width: 80px;
          -webkit-animation: cloud 20s linear infinite;
                  animation: cloud 20s linear infinite;
        }
        
        .cloud-3 {
          top: 45px;
          -webkit-animation: cloud 10s linear infinite;
                  animation: cloud 10s linear infinite;
        }
    </style>


</head>

<body>
    <canvas width="460" height="320"></canvas>
    <div class="volcano volcano-back">
        <svg id="volcano-back" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="108 230.697 865 467.303" width="865" height="467.303"><g><path d=" M 789 689 L 533 698 L 283 682 L 108 668 Q 273.759 572.579 340 494 Q 363.402 466.239 400 410 L 440 329 L 468 254 Q 471.39 247.858 477 244 Q 482.61 240.142 490 244 Q 500.248 237.219 505 237 C 509.752 236.781 522.534 239.137 527 243 C 531.466 246.863 532.249 249.001 540 250 Q 547.751 250.999 552 249.686 L 560 240 Q 564.54 235.93 569 234 Q 574.057 231.812 584 233 Q 593.965 233.341 598 237 C 602..........完整代码请登录后点击上方下载按钮下载查看

网友评论0