disable stars
This commit is contained in:
parent
3e9eb88434
commit
d77e4226fc
78
index.php
78
index.php
@ -23,83 +23,5 @@ for ($i = 0; $i < count($module_list); $i++) {
|
||||
else
|
||||
printModuleInfo($module_list[$i]);
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Flickering Stars Background</title>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background: black;
|
||||
height: 100%;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="starCanvas"></canvas>
|
||||
|
||||
<script>
|
||||
const canvas = document.getElementById('starCanvas');
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
let stars = [];
|
||||
const numStars = 200;
|
||||
|
||||
function resizeCanvas() {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
}
|
||||
|
||||
window.addEventListener('resize', resizeCanvas);
|
||||
resizeCanvas();
|
||||
|
||||
function createStars() {
|
||||
stars = [];
|
||||
for (let i = 0; i < numStars; i++) {
|
||||
stars.push({
|
||||
x: Math.random() * canvas.width,
|
||||
y: Math.random() * canvas.height,
|
||||
radius: Math.random() * 1.5 + 0.5,
|
||||
opacity: Math.random(),
|
||||
flicker: Math.random() * 0.02 + 0.01
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function drawStars() {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
for (let star of stars) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(star.x, star.y, star.radius, 0, Math.PI * 2);
|
||||
ctx.fillStyle = `rgba(255, 255, 255, ${star.opacity})`;
|
||||
ctx.fill();
|
||||
|
||||
// Flicker effect
|
||||
star.opacity += (Math.random() > 0.5 ? 1 : -1) * star.flicker;
|
||||
if (star.opacity < 0.1) star.opacity = 0.1;
|
||||
if (star.opacity > 1) star.opacity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function animate() {
|
||||
drawStars();
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
createStars();
|
||||
animate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user