first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
margin: 0;
padding: 0;
width: 100%;
height: 100vh;
}
span {
transition: all ease 1s;
}
</style>
</head>
<body>
</body>
<script src="./index.js"></script>
</html>

View File

@@ -0,0 +1,65 @@
var list = ["富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"];
var body = document.querySelector("body");
var index = 0;
body.onclick = function(e) {
var Xcoord = e.x;
var Ycoord = e.y;
var span = document.createElement("span");
var color = parseInt(Math.random() * 360);
span.innerText = list[index];
span.style.position = "fixed";
span.style.left = `${Xcoord}px`
span.style.top = `${Ycoord}px`
span.style.color = `hsl(${color},100%,50%,0.7)`;
var direction = [
'LeftTop', 'LeftBottom',
'RightTop', 'RightBottom',
];
var directionIndex = parseInt(Math.random() * direction.length);
motion(direction[directionIndex], span, Xcoord, Ycoord);
function motion(direction, el, X, Y) {
var newX = Math.random() * X
var newY = Math.random() * Y
setTimeout(function() {
switch (direction) {
case "LeftTop":
el.style.left = `${Xcoord-newX}px`
el.style.top = `${Ycoord-newY}px`
break;
case "RightTop":
el.style.left = `${Xcoord+newX}px`
el.style.top = `${Ycoord-newY}px`
break;
case "LeftBottom":
el.style.left = `${Xcoord-newX}px`
el.style.top = `${Ycoord+newY}px`
break;
case "RightBottom":
el.style.left = `${Xcoord+newX}px`
el.style.top = `${Ycoord+newY}px`
break;
default:
break;
}
}, 300);
setTimeout(function() {
body.removeChild(el)
}, 1300);
}
body.appendChild(span)
console.log(span);
index += 1;
if (index > 11) {
index = 0
}
}