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>
        .........完整代码请登录后点击上方下载按钮下载查看

网友评论0