html王茶主页雪花飘落特效代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>王茶</title>
     <link rel="icon" href="王茶(html版).png?x-oss-process=image/resize,w_300/format,webp">
</head>
<body background="https://pic.616pic.com/ys_bnew_img/00/46/61/YXXDMnpcSr.jpg" style="background-repeat:no-repeat; background-size:110% 110%; background-attachment:fixed">
    <h1 style="color:lightgreen">欢迎来到王茶</h1>
    <h1><div class="btn"><a href="http://127.0.0.1:55824/停车.html" target="_blank" style="color:#00ffff">bm停车场</a></div></h1>
    <h1><div class="lkn"><a href="http://127.0.0.1:55824/购物车.html" target="_blank" style="color:#00ffff">L1点餐</a></div></h1>
    <h1><div class="btn"><a href="http://127.0.0.1:55824/设置.html" target="_blank" style="color:#00ffff">L2设置</a></div></h1>
    <h1><div class="btn"><a href="http://127.0.0.1:55824/云集中心.html" target="_blank" style="color:#00ffff">L3gm space</a></div></h1>
    <!--
@王浩翔、@芳华集团(俗称GM公司)版权所有-->
<style>
body,
html {
    position: absolute;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #57c3c2;
    user-select: none;
}
canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    user-select: none;
    touch-action: none;
    content-zooming: none;
    background: lightgreen;
    cursor: crosshair;
}
</style>

</head>
<body>

<style>

body {

background-color: #000000;

}

.snowflake {

position: absolute;

font-size: 10px;

color: #FFFFFF;

text-shadow: 1px 1px 1px #000000;

user-select: none;

}

</style>


<script>

function random(min, max) {

return Math.floor(Math.random() * (max - min + 1)) + min;

}

function Snowflake() {

this.characters = "❄️";

this.x = random(0, window.innerWidth);

this.y = random(-200, -100);

this.speed = random(1, 5);

this.element = document.createElement("span");

this.element.classList.add("snowflake");

this.element.innerHTML = this.characters;

document.body.appendChild(this.element);

}

Snowflake.prototype.update = function() {

this.y += this.speed;

this.element.style.top = this.y + "px";

this.element.style.left = this.x + "px";

if (this.y > window.innerHeight) {

this.y = random(-200, -100);

this.x = random(0, window.innerWidth);

}

};

var snowflakes = [];

for (var i = 0; i < 100; i++) {

snowflakes.push(new Snowflake());

}

setInterval(function() {

snowflakes.forEach(function(snowflake) {

snowflake.update();

});

}, 50);

</script>

<!--<script>-->
// 芳华出品 必属精品.
<!--
"use strict";
class Mat2 {
    constructor() {
        this.a = 1.0;
        this.b = 0.0;
        this.c = 0.0;
        this.d = 1.0;
        this.tx = 0.0;
        this.ty = 0.0;
    }
    static create() {
        return new Mat2();
    }
    multiply(b) {
        const aa = this.a, ab = this.b, ac = this.c, ad = this.d;
        this.a = aa * b.a + ac * b.b;
        this.b = ab * b.a + ad * b.b;
        this.c = aa * b.c + ac * b.d;
        this.d = ab * b.c + ad * b.d;
        this.tx += aa * b.tx + ac * b.ty;
        this.ty += ab * b.tx + ad * b.ty;
        return this;
    }
    rotate(rad) {
        const aa = this.a, ab = this.b, ac = this.c, ad = this.d;
        const s = Math.sin(rad);
        const c = Math.cos(rad);
        this.a = aa * c + ac * s;
        this.b = ab * c + ad * s;
        this.c = aa * -s + ac * c;
        this.d = ab * -s + ad * c;
        return this;
    }
    translate(x, y) {
        this.tx += this.a * x + this.c * y;
        this.ty += this.b * x + this.d * y;
        return this;
    }
    scale(x, y) {
        this.a *= x;
        this.b *= x;
        this.c *= y;
        this.d *= y;
        return this;
    }
}
class WormObject {
    constructor(x, y, vx, vy, len) {
        this.vmt = Mat2.create().translate(x, y).rotate(Math.atan2(vy, vx));
        const angle = (Math.random() * Math.PI / 2) - (Math.PI / 4);
        this.tmt = Mat2.create().scale(0.92, 0.92).translate(len, 0).rotate(angle);
        this.c1x = this.p1x = -0.5 * this.vmt.c + this.vmt.tx;
        this.c1y = this.p1y = -0.5 * this.vmt.d + this.vmt.ty;
        this.c2x = this.p2x =  0.5 * this.vmt.c + this.vmt.tx;
        this.c2y = this.p2y =  0.5 * this.vmt.d + this.vmt.ty;
        this.r = angle;
        this.w = len * 0.4;
    }
    draw() {
        if (Math.random() > 0.9) {
            this.tmt.rotate(-this.r * 2);
            this.r *= -1;
        }
        this.vmt.multiply(this.tmt);
        const cc1x = -this.w * this.vmt.c + this.vmt.tx;
        const cc1y = -this.w * this.vmt.d + this.vmt.ty;
        const pp1x = (this.c1x + cc1x) / 2;
        const pp1y = (this.c1y + cc1y) / 2;
        const cc2x = this.w * this.vmt.c + this.vmt.tx;
        const cc2y = this.w * this.vmt.d + this.vmt.ty;
        const pp2x = (this.c2x + cc2x) / 2;
        const pp2y = (this.c2y + cc2y) / 2;
        ctx.beginPath();
        ctx.shadowColor = "lightgreen";
        ctx.shadowBlur = this.w * 2;
        ctx.shadowOffsetX = this.w * 0.5;
        ctx.shadowOffsetY = this.w * 0.5;
        ctx.strokeStyle = "#fff";
        ctx.fillStyle = `hsl(${Math.round(this.w * 6 - (hue += 0.04))}, 80%, 60%)`;
        ctx.moveTo(this.p1x, this.p1y);
        ctx.quadraticCurveTo(this.c1x, this.c1y, pp1x, pp1y);
        ctx.lineTo(pp2x, pp2y);
        ctx.quadraticCurveTo(this.c2x, this.c2y, this.p2x, this.p2y);
        ctx.closePath();
        ctx.fill();
        ctx.stroke();
        this.c1x = cc1x;
        this.c1y = cc1y;
        this.p1x = pp1x;
        this.p1y = pp1y;
        this.c2x = cc2x;
        this.c2y = cc2y;
        this.p2x = pp2x;
        this.p2y = pp2y;
    }
}
const canvas = {
    init() {
        this.elem = document.querySelector("canvas");
        this.resize();
        window.addEventListener("resize", () => this.resize(), false);
        return this.elem.getContext("2d");
    },
    resize() {
        this.width = this.elem.width = this.elem.offsetWidth;
        this.height = this.elem.height = this.elem.offsetHeight;
    }
};
const pointer = {
    frame: 0,
    grow(x, y) {
        const vx = x - this.px;
        const vy = y - this.py;
        const len = Math.min(Math.sqrt(vx * vx + vy * vy), 150);
        if (len < 10) return;
        vms.push(new WormObject(x, y, vx, vy, len));
        this.px = x;
        this.py = y;
    },
    move(e, touch) {
        e.preventDefault();
        const pointer = touch ? e.targetTouches[0] : e;
        this.x = pointer.clientX;
        this.y = pointer.clientY;
        this.grow(this.x, this.y);
        this.frame++;
        if (!(this.frame % 2)) {
            ctx.fillStyle = "rgba(0, 8, 16, 0.02)";
            ctx.fillRect(0, 0, canvas.width, canvas.height);
        }
    },
    init(canvas) {
        canvas.elem.addEventListener("mousemove", e => this.move(e, false), false);
        canvas.elem.addEventListener("touchmove", e => this.move(e, true), false);
    }
};
const ctx = canvas.init();
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, canvas.width, canvas.height);
pointer.init(canvas);
const vms = [];
let hue = 180;
const run = () => {
    requestAnimationFrame(run);
    for (let i = 0; i < vms.length; i++) {
        const o = vms[i];
        const x = o.vmt.a * o.vmt.a + o.vmt.b * o.vmt.b;
        if (x * o.w < 0.01) {
            vms.splice(i, 1);
            i--;
        } else o.draw();
    }
};
for (let a = 0; a < 2 * Math.PI; a += Math.random() > 0.9 ? 0.5 : 0.1) {
    setTimeout(() => {
        pointer.grow(
            canvas.width * 0.5 + Math.cos(a) * canvas.width * 0.25,
            canvas.height * 0.5 + Math.sin(a) * canvas.height * 0.25
        );
    }, a * 200);
}
run();
</script>
<div style="text-align:center;">
</div>
-->
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值