Skip to content
Snippets Groups Projects
Commit f2c4aba9 authored by tongwenjing's avatar tongwenjing
Browse files

Upload From local development env

parent 80bfaddb
No related branches found
No related tags found
No related merge requests found
Pipeline #20438 passed
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
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment