From f2c4aba99ee3b758237f931b821f739a291ffaa6 Mon Sep 17 00:00:00 2001 From: tongwenjing <656274287@qq.com> Date: Tue, 2 Aug 2022 16:08:35 +0800 Subject: [PATCH] Upload From local development env --- static/particle.js | 39 +++++++++++++++++++-------------------- wiki/pages/index.html | 4 ++-- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/static/particle.js b/static/particle.js index 6ae27a7..987d241 100644 --- a/static/particle.js +++ b/static/particle.js @@ -1,33 +1,32 @@ -var back = document.getElementById("back") -var pixaldata = [] -var pixallife = 300 +var back = document.getElementById("back"); +var pixaldata = []; +var pixallife = 300; window.addEventListener("mousemove", function (evt) { - var span = document.createElement("span") - span.className = "pixal" - back.appendChild(span) + var span = document.createElement("span"); + span.className = "pixal"; + back.appendChild(span); pixaldata.push({ age: 0, - color: "rgba(" + parseInt(Math.random() * 255) + "," + parseInt(Math.random() * 255) + "," + parseInt(Math.random() * 255) +"," + parseInt(Math.random() * 255)+ ")", //ç²’å颜色 - vx: Math.random()*0.5, + color: "rgba(" + parseInt(Math.random() * 255) + "," + parseInt(Math.random() * 255) + "," + parseInt(Math.random() * 255) +"," + parseInt(Math.random() * 255)+ ")", vy: Math.random()*0.75, sx: evt.x, sy: evt.y - }) + }); }) function draw() { for (var i = 0; i < pixaldata.length; i++) { - pixal = pixaldata[i] - children = back.children[i] - pixal.age++ - pixal.sx += pixal.vx * 2 - pixal.sy += pixal.vy * 2 - children.style.background = pixal.color - children.style.left = pixal.sx + "px" - children.style.top = pixal.sy + "px" + pixal = pixaldata[i]; + children = back.children[i]; + pixal.age++; + pixal.sx += pixal.vx * 2; + pixal.sy += pixal.vy * 2; + children.style.background = pixal.color; + children.style.left = pixal.sx + "px"; + children.style.top = pixal.sy + "px"; if (pixal.age >= pixallife) { - pixaldata.splice(i, 1) - back.removeChild(back.childNodes[i]) + pixaldata.splice(i, 1); + back.removeChild(back.childNodes[i]); } } } -setInterval(draw, 1) \ No newline at end of file +setInterval(draw, 1); \ No newline at end of file diff --git a/wiki/pages/index.html b/wiki/pages/index.html index 04174ef..6a98b9f 100755 --- a/wiki/pages/index.html +++ b/wiki/pages/index.html @@ -10,12 +10,12 @@ align-self: center; } .firstPage{ - height: 100%; + height: 100vh; width: 100%; position: sticky; scroll-snap-align: start; scroll-snap-type: y mandatory; - overflow: scroll; + overflow: hidden; background-color: #323232; color: aliceblue; text-align: center; -- GitLab