132 lines
3.4 KiB
HTML
132 lines
3.4 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<title>THOS Screensaver</title>
|
||
|
<style>
|
||
|
body,
|
||
|
html {
|
||
|
margin: 0;
|
||
|
padding: 0;
|
||
|
overflow: hidden;
|
||
|
background-color: #000;
|
||
|
cursor: none;
|
||
|
font-family: 'Montserrat', sans-serif;
|
||
|
}
|
||
|
|
||
|
canvas {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
position: absolute;
|
||
|
top: 0;
|
||
|
left: 0;
|
||
|
z-index: 1;
|
||
|
}
|
||
|
|
||
|
.branding {
|
||
|
position: absolute;
|
||
|
bottom: 20px;
|
||
|
right: 20px;
|
||
|
color: rgba(255, 255, 255, 0.3);
|
||
|
text-align: right;
|
||
|
z-index: 2;
|
||
|
}
|
||
|
|
||
|
.brand-name {
|
||
|
font-weight: 600;
|
||
|
font-size: 2rem;
|
||
|
line-height: 1.2;
|
||
|
}
|
||
|
|
||
|
.brand-tagline {
|
||
|
font-weight: 300;
|
||
|
font-size: 1rem;
|
||
|
text-transform: uppercase;
|
||
|
letter-spacing: 2px;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<canvas id="screensaver"></canvas>
|
||
|
<div class="branding">
|
||
|
<div class="brand-name">THOS</div>
|
||
|
<div class="brand-tagline">Clean made easy</div>
|
||
|
</div>
|
||
|
<script>
|
||
|
const canvas = document.getElementById('screensaver');
|
||
|
const ctx = canvas.getContext('2d');
|
||
|
|
||
|
canvas.width = window.innerWidth;
|
||
|
canvas.height = window.innerHeight;
|
||
|
|
||
|
class Particle {
|
||
|
constructor() {
|
||
|
this.reset();
|
||
|
}
|
||
|
|
||
|
reset() {
|
||
|
this.x = Math.random() * canvas.width;
|
||
|
this.y = Math.random() * canvas.height;
|
||
|
this.radius = Math.random() * 3 + 1;
|
||
|
this.speedX = (Math.random() - 0.5) * 3;
|
||
|
this.speedY = (Math.random() - 0.5) * 3;
|
||
|
this.color = `hsl(${Math.random() * 360}, 70%, 50%)`;
|
||
|
}
|
||
|
|
||
|
update() {
|
||
|
this.x += this.speedX;
|
||
|
this.y += this.speedY;
|
||
|
|
||
|
if (this.x < 0) this.x = canvas.width;
|
||
|
if (this.x > canvas.width) this.x = 0;
|
||
|
if (this.y < 0) this.y = canvas.height;
|
||
|
if (this.y > canvas.height) this.y = 0;
|
||
|
}
|
||
|
|
||
|
draw() {
|
||
|
ctx.beginPath();
|
||
|
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
|
||
|
ctx.fillStyle = this.color;
|
||
|
ctx.fill();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const particles = [];
|
||
|
const particleCount = 200;
|
||
|
|
||
|
for (let i = 0; i < particleCount; i++) {
|
||
|
particles.push(new Particle());
|
||
|
}
|
||
|
|
||
|
function animate() {
|
||
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||
|
|
||
|
particles.forEach(particle => {
|
||
|
particle.update();
|
||
|
particle.draw();
|
||
|
});
|
||
|
|
||
|
requestAnimationFrame(animate);
|
||
|
}
|
||
|
|
||
|
animate();
|
||
|
|
||
|
window.addEventListener('resize', () => {
|
||
|
canvas.width = window.innerWidth;
|
||
|
canvas.height = window.innerHeight;
|
||
|
});
|
||
|
|
||
|
const notifyParent = () => {
|
||
|
window.parent.postMessage({ type: "user_active" }, "*");
|
||
|
};
|
||
|
|
||
|
['mousemove', 'mousedown', 'keydown', 'touchstart', 'wheel'].forEach(event => {
|
||
|
document.addEventListener(event, notifyParent, { passive: true });
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
|
||
|
</html>
|