particles+svg实现圣诞下雪鼠标跟随轮廓绘制圣诞树效果代码

代码语言:html

所属分类:其他

代码描述:particles+svg实现圣诞下雪鼠标跟随轮廓绘制圣诞树效果代码

代码标签: particles svg 圣诞 下雪 鼠标 跟随 轮廓 绘制 圣诞树

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

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">

        <style>
            body {
                display: flex;
                justify-content: center;
                align-items: center;
                height: 100vh;
                margin: 0;
                background-color: #000;
            }

            .container {
                position: relative;
                width: 100%;
                max-width: 1000px;
                aspect-ratio: 1 / 1;
                cursor: none;
            }

            .base-image {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                z-index: 1;
                object-fit: cover;
            }

            .final-image {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                z-index: 2;
                clip-path: circle(0px at var(--x, 0px) var(--y, 0px));
                will-change: clip-path;
            }

            .container:hover .final-image {
                clip-path: circle(10% at var(--x, 0px) var(--y, 0px));
            }

            #particles-js {
                position: fixed;
                top: 0;
                left: 0;
                z-index: 3;
                width: 100vw;
                height: 100vh;
                overflow: hidden;
            }

            @media (max-width: 768px) {
                .container {
                    max-width: 90%;
                }

                .container:hover .final-image {
                    clip-path: circle(15% at var(--x, 0px) var(--y, 0px));
                }
            }

            @media (max-width: 480px) {
                .container {
                    max-width: 100%;
                }

                .container:hover .final-image {
                    clip-path: circle(20% at var(--x, 0px) var(--y, 0px));
                }
            }
        </style>
    
    </head>
    <body translate="no">
        <div class="container">
            <div id="particles-js"></div>
            <!-- Animated using SVGANIMA - https://svganima.com -->
            <svg width="100%" height="100%" viewBox="0 0 900 900" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule: evenodd; clip-rule: evenodd; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 1.5; fill: rgb(0, 0, 0); stroke: none; stroke-width: 1px; opacity: 1; filter: none;" id="svg4571" preserveAspectRatio="xMidYMid" class="base-image">
                <defs id="defs2515"></defs>
                <g id="LINES" style="fill: rgb(0, 0, 0); stroke: none; stroke-width: 1px; stroke-linejoin: round; stroke-linecap: round; stroke-miterlimit: 1.5; opacity: 1; filter: none;">
                    <g id="Sly-right" transform="matrix(0.76769,0,0,0.76769,104.039,2.48585)">
                        <path d="M 450 0 C 698.362 0 900 201.638 900 450 C 900 510.617 887.989 568.451 866.218 621.249" style="fill: none; stroke: rgb(66, 138, 171); stroke-width: 3.91px; stroke-linejoin: round; stroke-linecap: round; stroke-miterlimit: 1.5; opacity: 1; filter: none; stroke-dasharray: 883px; stroke-dashoffset: 883px;" id="path6355">
                            <animate attributeType="auto" attributeName="stroke-dashoffset" values="-883;-883;0;0" calcMode="spline" keyTimes="0; 0.008862530818951156; 0.026717531818484706; 1" keySplines=".5 .5 .5 1;.5 .5 .5 1;.5 .5 .5 1" dur="300.14s" begin="0s" repeatCount="1" additive="replace" accumulate="none" id="animate9687" style="stroke: rgb(66, 138, 171); stroke-width: 3.91px; stroke-linejoin: round; stroke-linecap: round; stroke-miterlimit: 1.5; opacity: 1; filter: none; fill: none;"></animate>
                        </path>
                    </g>
                    <g id="Sly-left" transform="matrix(0.76769,0,0,0.76769,104.039,2.48585)">
                        <path d="M 39.493 634.489 C 14.121 578.179 0 515.726 0 450 C 0 201.638 201.638 0 450 0" style="fill: none; stroke: rgb(66, 138, 171); stroke-width: 3.91px; stroke-linejoin: round; stroke-linecap: round; stroke-miterlimit: 1.5; opacity: 1; filter: none; stroke-dasharray: 897px; stroke-dashoffset: 897px;" id="path9279">
                            <animate attributeType="auto" attributeName="stroke-dashoffset" values="897;897;0;0" calcMode="spline" keyTimes="0; 0.011994402612114347; 0.026717531818484706; 1" keySplines=".5 .5 .5 1;.5 .5 .5 1;.5 .5 .5 1" dur="300.14s" begin="0s" repeatCount="1" additive="replace" accumulate="none" id="animate5718" style="stroke: rgb(66, 138, 171); stroke-width: 3.91px; stroke-linejoin: round; stroke-linecap: round; stroke-miterlimit: 1.5; opacity: 1; filter: none; fill: none;"></animate>
                        </path>
                    </g>
                    <g id="Trees-left" transform="matrix(0.766838,0,0,0.766838,104.806,-0.233162)">
                        <path d="M 450.152 1173.95 C 450.152 1173.95 450.152 1193.52 450.152 1173.95 C 450.152 901.558 304.081 941.914 134.817 776.297 C 94.705 737.119 61.869 690.525 38.537 638.74 C 51.675 605.276 60.938 571.642 60.834 535.033 C 69.933 558.016 77.378 581.745 87.599 604.27 C 95.844 622.441 105.748 639.283 112.427 658.17 C 106.789 655.307 101.031 652.713 95.139 650.53 C 100.784 663.367 106.529 676.172 112.253 688.979 C 117.424 673.177 122.934 657.733 128.842 642.366 C 124.204 644.448 119.573 646.544 114.939 648.645 C 124.468 616.894 143.448 587.779 153.607 555.799 C 156.134 572.122 156.464 588.922 160.735 604.938 C 165.1 621.309 173.549 634.714 181.936 649.175 C 177.151 648.754 172.111 648.279 167.083 647.505 C 169.977 652.115 173.196 656.867 176.73 661.984 C 177.629 663.285 178.515 664.592 179.389 665.903 C 188.732 641.076 198.76 616.814 211.547 593.133 C 202.098 596.985 192.67 600.881 183.39 605.071 C 193.4 583.939 205.478 563.494 214.83 542.133 C 217.287 536.522 219.345 530.878 221.124 525.199 C 214.184 528.299 207.089 531.139 200.185 534.069 C 213.481 500.074 217.416 464.381 228.772 429.924 C 236.065 465.693 258.504 490.381 278.088 520.886 C 273.617 520.348 269.178 519.757 264.756 519.109 C 267.824 523.274 270.788 527.5 273.556 531.844" style="fill: none; stroke: rgb(59, 83, 139); stroke-width: 3.91px; stroke-linecap: round; stroke-miterlimit: 2; stroke-linejoin: round; opacity: 1; filter: none; stroke-dasharray: 1800px; stroke-dashoffset: 1800px;" id="path4604">
                            <animate attributeType="auto" attributeName="stroke-dashoffset" values="1800;0;0" calcMode="spline" keyTimes="0; 0.026717531818484706; 1" keySplines=".5 0 .5 1;.5 0 .5 1" dur="300.14s" begin="0s" repeatCount="1" additive="replace" accumulate="none" id="animate4776" style="stroke: rgb(59, 83, 139); stroke-width: 3.91px; stroke-linejoin: round; stroke-linecap: butt; stroke-miterlimit: 2; opacity: 1; filter: none; fill: none;"></animate>
                        </path>
                    </g>
                    <g id="Trees-right" transform="matrix(-0.766838,0,0,0.766838,795.194,-0.233162)" style="fill: rgb(0, 0, 0); stroke: none; stroke-width: 1px; stroke-linejoin: round; stroke-linecap: round; stroke-miterlimit: 1.5; opacity: 1; filter: none;">
                        <path d="M 450.152 1173.95 C 450.152 1173.95 450.152 1193.52 450.152 1173.95 C 450.152 937.144 304.081 941.914 134.817 776.297 C 94.856 737.196 55.367 678.818 34.124 625.205 C 36.783 609.762 38.164 595.869 37.602 582.963 C 52.265 623.663 73.954 649.084 95.322 679.903 C 101.401 662.689 108.346 645.7 115.689 628.838 C 110.188 631.319 104.682 633.792 99.182 636.276 C 111.589 609.875 123.468 583.139 134.515 556.132 C 129.788 558.39 125.073 560.673 120.378 563.01 C 132.206 532.071 146.431 498.469 149.795 449.566 C 159.173 487.851 172.758 515.123 186.117 538.123" style="fill: none; stroke: rgb(38, 66, 124); stroke-width: 3.91px; stroke-linecap: round; stroke-miterlimit: 2; stroke-linejoin: round; opacity: 1; filter: none; stroke-dasharray: 1300px; stroke-dashoffset: 1300px;" id="path1294">
                            <animate attributeType="auto" attributeName="stroke-dashoffset" values="1300;0;0" calcMode="spline" keyTimes="0; 0.01665889251682548; 1" keySplines=".5 0 .5 1;.5 0 .5 1" dur="300.14s" begin="0s" repeatCount="1" additive="replace" accumulate="none" id="animate3553" style="stroke: rgb(38, 66, 124); stroke-width: 3.91px; stroke-linejoin: round; stroke-linecap: butt; stroke-miterlimit: 2; opacity: 1; filter: none; fill: none;"></animate>
                        </path>
                    </g>
                    <g id="Tree" transform="matrix(0.766838,0,0,0.766838,104.806,-0.233162)">
                        <path d=" M 450.152 1173.95 C 445.479 864.731 425.111 757.707 357.935 757.707 C 344.26 757.707 340.409 742.528 343.585 722.215 C 337.532 733.713 328.873 741.373 316.869 738.418 C 307.73 736.175 307.237 726.168 310.478 714.359 C 302.454 720.413 293.303 723.861 284.138 719.881 C 275.907 716.316 275.103 705.739 277.955 693.541 C 270.255 698.584 262.736 701.151 257.642 698.61 C 248.088 693.865 251.614 682.562 256.203 674.123 C 255.891 674.123 255.567 674.136 255.269 674.123 C 228.501 672.865 233.259 640.249 233.259 640.249 C 233.259 640.249 256.656 638.914 282.945 629.309 C 284.889 628.596 286.873 627.818 288.856 627.015 C 304.347 620.675 320.295 611.346 332.624 597.652 C 329.899 599.623 326.817 601.268 323.336 602.517 C 298.966 611.241 293.081 588.737 298.59 575.464 C 287.896 577.278 265.898 578.134 258.211 556.914 C 258.211 556.914 258.88398426366047 555.8801944057213 260.4269842636605 555.1951944057213 C 260.3669703118478 554.9551806695711 260.484 555.394 260.429 555.148 C 260.428 555.149 338.085 517.626 358.781 465.5 C 357.515 464.418 356.468 463.099 355.627 461.613 C 353.579 458.022 352.75 453.446 352.931 448.883 C 350.597 449.155 347.577 449.22 344.388 448.572 C 339.514 447.574 334.225 444.877 330.375 438.59 C 328.392 435.349 326.797 431.149 325.825 425.744 C 325.825 425.744 325.877 425.704 325.993 425.652 C 328.65 424.123 361.912 404.614 379.814 377.768 C 384.136 371.29 387.557 364.389 389.438 357.208 C 359.2 363.11 357.05 335.786 356.897 331.881 C 356.897 331.88 356.896 331.88 356.896 331.879 C 356.884 331.591 356.884 331.424 356.884 331.414 C 356.883 331.413 356.883 331.412 356.883 331.412 C 373.567 327.201 394.293 298.623 404.161 264.769 C 405.357 260.667 407.232 255.63 407.21 255.659 C 398.523 267.334 381.016 263.946 380.372 244.998 C 380.372 244.997 420.195 231.232 430.823 180.032 C 431.463 176.95 432.21 169.401 432.806 166.029 C 433.338 163.054 434.44 164.181 435.58 160.809 C 437.161 156.171 438.808 151.244 439.119 146.346 L 448.953 130.381 L 458.407 143.519 C 458.523 14.........完整代码请登录后点击上方下载按钮下载查看

网友评论0