anycoder-0e1ef9f4 / index.html
Pantominus's picture
Upload folder using huggingface_hub
fade157 verified
Raw History Blame Contribute Delete
12 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HELLO | Interactive Experience</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght=900&family=Inter:wght=400;600&display=swap" rel="stylesheet">
<style>
:root {
--bg-color: #050505;
--text-color: #ffffff;
--accent-1: #00f2ff;
--accent-2: #ff0055;
--accent-3: #7000ff;
--font-display: 'Montserrat', sans-serif;
--font-body: 'Inter', sans-serif;
}
* {
box-sizing: box-sizing;
margin: 0;
padding: 0;
}
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: var(--font-body);
overflow: hidden; /* Prevent scroll for the canvas bg */
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
}
/* --- Background Canvas --- */
#bg-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
opacity: 0.6;
}
/* --- Header / Nav --- */
header {
position: absolute;
top: 20px;
left: 20px;
z-index: 10;
mix-blend-mode: difference;
}
.brand-link {
text-decoration: none;
color: #fff;
font-weight: 600;
font-size: 0.9rem;
letter-spacing: 0.5px;
border: 1px solid rgba(255,255,255,0.3);
padding: 8px 16px;
border-radius: 20px;
transition: all 0.3s ease;
backdrop-filter: blur(5px);
display: flex;
align-items: center;
gap: 8px;
}
.brand-link:hover {
background: rgba(255,255,255,0.1);
border-color: var(--accent-1);
box-shadow: 0 0 15px var(--accent-1);
}
/* --- Main Content --- */
main {
z-index: 5;
position: relative;
text-align: center;
perspective: 1000px;
}
/* The Big Text */
.hero-text {
font-family: var(--font-display);
font-size: clamp(4rem, 15vw, 12rem);
font-weight: 900;
line-height: 0.9;
letter-spacing: -5px;
cursor: pointer;
position: relative;
transition: transform 0.1s ease-out;
user-select: none;
/* Gradient Text */
background: linear-gradient(
to right,
var(--accent-1) 20%,
var(--text-color) 40%,
var(--accent-2) 60%,
var(--accent-3) 80%
);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-clip: text;
background-size: 200% auto;
animation: shine 5s linear infinite;
}
@keyframes shine {
to { background-position: 200% center; }
}
/* Hover Glow Effect */
.hero-text::after {
content: "HELLO";
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: -1;
color: transparent;
-webkit-text-stroke: 2px rgba(255,255,255,0.1);
filter: blur(20px);
opacity: 0;
transition: opacity 0.3s ease;
}
.hero-text:hover::after {
opacity: 0.8;
}
/* Subtext */
.sub-text {
margin-top: 20px;
font-size: clamp(0.8rem, 2vw, 1.2rem);
opacity: 0;
transform: translateY(20px);
animation: fadeUp 1s ease forwards 0.5s;
color: rgba(255,255,255,0.7);
max-width: 400px;
line-height: 1.5;
}
@keyframes fadeUp {
to { opacity: 1; transform: translateY(0); }
}
/* --- Interaction Button --- */
.action-btn {
margin-top: 40px;
background: transparent;
border: 1px solid rgba(255,255,255,0.2);
color: white;
padding: 12px 30px;
font-family: var(--font-body);
font-size: 1rem;
cursor: pointer;
border-radius: 4px;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
position: relative;
overflow: hidden;
}
.action-btn::before {
content: '';
position: absolute;
top: 0; left: 0; width: 100%; height: 100%;
background: var(--accent-1);
opacity: 0;
z-index: -1;
transition: opacity 0.3s ease;
}
.action-btn:hover {
transform: scale(1.05);
border-color: var(--accent-1);
box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
}
.action-btn:hover::before {
opacity: 0.1;
}
/* --- Particles Overlay --- */
.particle-overlay {
position: absolute;
pointer-events: none;
top: 0; left: 0; width: 100%; height: 100%;
z-index: 4;
mix-blend-mode: overlay;
}
/* --- Footer --- */
footer {
position: absolute;
bottom: 20px;
right: 20px;
font-size: 0.7rem;
opacity: 0.4;
z-index: 10;
}
</style>
</head>
<body>
<!-- Header with required link -->
<header>
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="brand-link">
<span>Built with anycoder</span>
</a>
</header>
<!-- Background Canvas for Stars -->
<canvas id="bg-canvas"></canvas>
<!-- Main Content -->
<main>
<div class="hero-text" id="hero-text">HELLO</div>
<div class="sub-text">
Welcome to the interface. <br>
Hover to distort. Click to explode.
</div>
<button class="action-btn" id="reset-btn">Reset View</button>
</main>
<footer>
&copy; Generated Application
</footer>
<script>
/**
* 1. CANVAS BACKGROUND SYSTEM
* Creates a starfield that moves slowly
*/
const canvas = document.getElementById('bg-canvas');
const ctx = canvas.getContext('2d');
let width, height;
let stars = [];
const starCount = 150;
function resize() {
width = canvas.width = window.innerWidth;
height = canvas.height = window.innerHeight;
}
class Star {
constructor() {
this.x = Math.random() * width;
this.y = Math.random() * height;
this.z = Math.random() * 2 + 0.5; // Depth factor
this.size = Math.random() * 1.5;
this.alpha = Math.random();
this.flashSpeed = Math.random() * 0.02;
}
update() {
this.y -= 0.2 * this.z; // Move up
this.alpha += this.flashSpeed;
if (this.alpha > 1 || this.alpha < 0.2) this.flashSpeed = -this.flashSpeed;
if (this.y < 0) {
this.y = height;
this.x = Math.random() * width;
}
}
draw() {
ctx.fillStyle = `rgba(255, 255, 255, ${Math.abs(this.alpha)})`;
ctx.beginPath();
ctx.arc(this.x, this.y, this.size * this.z, 0, Math.PI * 2);
ctx.fill();
}
}
function initStars() {
stars = [];
for(let i = 0; i < starCount; i++) {
stars.push(new Star());
}
}
function animateStars() {
ctx.clearRect(0, 0, width, height);
stars.forEach(star => {
star.update();
star.draw();
});
requestAnimationFrame(animateStars);
}
window.addEventListener('resize', resize);
resize();
initStars();
animateStars();
/**
* 2. 3D TEXT INTERACTION
* Rotates the text based on mouse position relative to the center
*/
const heroText = document.getElementById('hero-text');
const mainContainer = document.querySelector('main');
mainContainer.addEventListener('mousemove', (e) => {
const x = e.clientX;
const y = e.clientY;
const middleX = window.innerWidth / 2;
const middleY = window.innerHeight / 2;
// Calculate offset from center
const offsetX = (x - middleX) / middleX;
const offsetY = (y - middleY) / middleY;
// Apply rotation
// We rotate Y axis based on X offset, and X axis based on Y offset
heroText.style.transform = `rotateY(${offsetX * 20}deg) rotateX(${offsetY * -20}deg)`;
});
// Reset on mouse leave
mainContainer.addEventListener('mouseleave', () => {
heroText.style.transform = `rotateY(0deg) rotateX(0deg)`;
});
/**
* 3. CLICK EXPLOSION EFFECT
* Creates a burst of particles on click
*/
const resetBtn = document.getElementById('reset-btn');
function createExplosion(x, y) {
const colors = ['#00f2ff', '#ff0055', '#7000ff', '#ffffff'];
for (let i = 0; i < 30; i++) {
const particle = document.createElement('div');
particle.style.position = 'absolute';
particle.style.left = x + 'px';
particle.style.top = y + 'px';
particle.style.width = Math.random() * 6 + 2 + 'px';
particle.style.height = particle.style.width;
particle.style.background = colors[Math.floor(Math.random() * colors.length)];
particle.style.borderRadius = '50%';
particle.style.pointerEvents = 'none';
particle.style.zIndex = '100';
particle.style.transition = 'all 1s cubic-bezier(0, .9, .57, 1)';
document.body.appendChild(particle);
// Random direction
const angle = Math.random() * Math.PI * 2;
const velocity = Math.random() * 100 + 50;
const tx = Math.cos(angle) * velocity;
const ty = Math.sin(angle) * velocity;
// Animate
setTimeout(() => {
particle.style.transform = `translate(${tx}px, ${ty}px) scale(0)`;
particle.style.opacity = '0';
}, 10);
// Cleanup
setTimeout(() => {
particle.remove();
}, 1000);
}
}
heroText.addEventListener('click', (e) => {
createExplosion(e.clientX, e.clientY);
});
resetBtn.addEventListener('click', () => {
heroText.style.transform = `rotateY(0deg) rotateX(0deg)`;
// Add a flash effect to the background
canvas.style.opacity = '0';
setTimeout(() => canvas.style.opacity = '0.6', 100);
});
</script>
</body>
</html>