Spaces:
Running

anycoder-c2bda4d6 / index.html
Dumasha's picture
Upload folder using huggingface_hub
3a00031 verified
Raw History Blame Contribute Delete
26.1 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Satisfying Space - Interactive Relaxation</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');
:root {
--primary: #6366f1;
--secondary: #ec4899;
--accent: #06b6d4;
--bg-dark: #0f172a;
--bg-light: #f8fafc;
--glass-bg: rgba(255, 255, 255, 0.05);
--glass-border: rgba(255, 255, 255, 0.1);
--shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Outfit', sans-serif;
overflow: hidden;
background: var(--bg-dark);
color: white;
cursor: crosshair;
}
/* Animated Background Mesh */
.mesh-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -2;
background:
radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.4) 0%, transparent 50%),
radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.4) 0%, transparent 50%),
radial-gradient(circle at 40% 20%, rgba(6, 182, 212, 0.4) 0%, transparent 50%),
var(--bg-dark);
filter: blur(60px);
animation: meshMove 20s ease-in-out infinite;
}
@keyframes meshMove {
0%, 100% { transform: translate(0, 0) scale(1); }
33% { transform: translate(30px, -30px) scale(1.1); }
66% { transform: translate(-20px, 20px) scale(0.9); }
}
/* Noise Texture Overlay */
.noise {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
opacity: 0.03;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
pointer-events: none;
}
/* Canvas for Particles */
#particleCanvas {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
/* Header */
header {
position: fixed;
top: 0;
left: 0;
right: 0;
padding: 1.5rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 100;
background: linear-gradient(to bottom, rgba(15, 23, 42, 0.8), transparent);
backdrop-filter: blur(10px);
}
.logo {
font-size: 1.5rem;
font-weight: 800;
background: linear-gradient(135deg, var(--primary), var(--secondary));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
display: flex;
align-items: center;
gap: 0.5rem;
}
.anycoder-link {
font-size: 0.875rem;
color: rgba(255, 255, 255, 0.6);
text-decoration: none;
padding: 0.5rem 1rem;
border: 1px solid var(--glass-border);
border-radius: 2rem;
background: var(--glass-bg);
backdrop-filter: blur(10px);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.anycoder-link::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
transition: left 0.5s;
}
.anycoder-link:hover {
color: white;
border-color: var(--primary);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}
.anycoder-link:hover::before {
left: 100%;
}
/* Main Content */
.container {
position: relative;
z-index: 10;
height: 100vh;
display: grid;
place-items: center;
padding: 2rem;
}
/* Breathing Circle */
.breathing-container {
position: relative;
width: 300px;
height: 300px;
display: flex;
align-items: center;
justify-content: center;
}
.breathing-circle {
position: absolute;
width: 200px;
height: 200px;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.2), transparent),
linear-gradient(135deg, var(--primary), var(--secondary));
box-shadow:
0 0 60px rgba(99, 102, 241, 0.5),
inset 0 0 60px rgba(255,255,255,0.2);
animation: breathe 8s ease-in-out infinite;
cursor: pointer;
transition: transform 0.3s ease;
}
.breathing-circle:hover {
transform: scale(1.05);
}
.breathing-circle.inhale {
animation: inhale 4s ease-in-out forwards;
}
.breathing-circle.exhale {
animation: exhale 4s ease-in-out forwards;
}
@keyframes breathe {
0%, 100% { transform: scale(1); opacity: 0.8; }
50% { transform: scale(1.5); opacity: 0.4; }
}
@keyframes inhale {
0% { transform: scale(1); }
100% { transform: scale(1.5); }
}
@keyframes exhale {
0% { transform: scale(1.5); }
100% { transform: scale(1); }
}
.breathing-text {
position: absolute;
font-size: 1.25rem;
font-weight: 300;
letter-spacing: 0.2em;
text-transform: uppercase;
opacity: 0.9;
pointer-events: none;
text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
/* Glass Control Panel */
.controls {
position: fixed;
bottom: 2rem;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 1rem;
padding: 1rem 2rem;
background: var(--glass-bg);
backdrop-filter: blur(20px);
border: 1px solid var(--glass-border);
border-radius: 2rem;
box-shadow: var(--shadow);
z-index: 100;
flex-wrap: wrap;
justify-content: center;
max-width: 90vw;
}
.control-btn {
background: transparent;
border: 1px solid var(--glass-border);
color: white;
padding: 0.75rem 1.5rem;
border-radius: 1rem;
cursor: pointer;
font-family: inherit;
font-size: 0.9rem;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
align-items: center;
gap: 0.5rem;
position: relative;
overflow: hidden;
}
.control-btn::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, var(--primary), var(--secondary));
opacity: 0;
transition: opacity 0.3s;
z-index: -1;
}
.control-btn:hover {
transform: translateY(-2px);
border-color: transparent;
box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}
.control-btn:hover::before {
opacity: 1;
}
.control-btn.active {
background: linear-gradient(135deg, var(--primary), var(--secondary));
border-color: transparent;
box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}
/* Color Palette */
.palette {
position: fixed;
top: 50%;
right: 2rem;
transform: translateY(-50%);
display: flex;
flex-direction: column;
gap: 1rem;
z-index: 100;
}
.color-btn {
width: 40px;
height: 40px;
border-radius: 50%;
border: 2px solid transparent;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.color-btn::after {
content: '';
position: absolute;
inset: -4px;
border-radius: 50%;
border: 2px solid white;
opacity: 0;
transform: scale(0.8);
transition: all 0.3s ease;
}
.color-btn:hover {
transform: scale(1.2);
}
.color-btn.active::after {
opacity: 1;
transform: scale(1);
}
.color-btn.purple { background: linear-gradient(135deg, #6366f1, #ec4899); }
.color-btn.ocean { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.color-btn.sunset { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.color-btn.forest { background: linear-gradient(135deg, #10b981, #059669); }
/* Stats Display */
.stats {
position: fixed;
top: 6rem;
left: 2rem;
font-size: 0.875rem;
color: rgba(255,255,255,0.5);
font-family: monospace;
pointer-events: none;
line-height: 1.6;
}
/* Responsive */
@media (max-width: 768px) {
.breathing-container {
width: 250px;
height: 250px;
}
.breathing-circle {
width: 150px;
height: 150px;
}
.palette {
flex-direction: row;
top: auto;
bottom: 7rem;
right: 50%;
transform: translateX(50%);
}
.controls {
bottom: 1rem;
padding: 0.75rem 1rem;
gap: 0.5rem;
}
.control-btn {
padding: 0.5rem 1rem;
font-size: 0.8rem;
}
}
/* Loading Animation */
.loader {
position: fixed;
inset: 0;
background: var(--bg-dark);
z-index: 1000;
display: grid;
place-items: center;
transition: opacity 0.5s ease;
}
.loader.hidden {
opacity: 0;
pointer-events: none;
}
.loader-circle {
width: 60px;
height: 60px;
border: 3px solid transparent;
border-top-color: var(--primary);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Floating Elements */
.floating {
animation: floating 6s ease-in-out infinite;
}
@keyframes floating {
0%, 100% { transform: translateY(0px); }
50% { transform: translateY(-20px); }
}
</style>
</head>
<body>
<!-- Loading Screen -->
<div class="loader" id="loader">
<div class="loader-circle"></div>
</div>
<!-- Background Elements -->
<div class="mesh-bg" id="meshBg"></div>
<div class="noise"></div>
<canvas id="particleCanvas"></canvas>
<!-- Header -->
<header>
<div class="logo">
<i class="fas fa-infinity"></i>
<span>Satisfying Space</span>
</div>
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
<i class="fas fa-code"></i> Built with anycoder
</a>
</header>
<!-- Stats -->
<div class="stats" id="stats">
Particles: <span id="particleCount">0</span><br>
FPS: <span id="fps">60</span><br>
Mode: <span id="currentMode">Flow</span>
</div>
<!-- Main Content -->
<div class="container">
<div class="breathing-container floating" id="breathingContainer">
<div class="breathing-circle" id="breathingCircle"></div>
<div class="breathing-text" id="breathingText">Breathe</div>
</div>
</div>
<!-- Color Palette -->
<div class="palette">
<button class="color-btn purple active" data-theme="purple" onclick="setTheme('purple')"></button>
<button class="color-btn ocean" data-theme="ocean" onclick="setTheme('ocean')"></button>
<button class="color-btn sunset" data-theme="sunset" onclick="setTheme('sunset')"></button>
<button class="color-btn forest" data-theme="forest" onclick="setTheme('forest')"></button>
</div>
<!-- Controls -->
<div class="controls">
<button class="control-btn active" onclick="setMode('flow')">
<i class="fas fa-water"></i> Flow
</button>
<button class="control-btn" onclick="setMode('breathe')">
<i class="fas fa-lungs"></i> Breathe
</button>
<button class="control-btn" onclick="setMode('chaos')">
<i class="fas fa-meteor"></i> Chaos
</button>
<button class="control-btn" onclick="toggleParticles()">
<i class="fas fa-atom"></i> Particles
</button>
<button class="control-btn" onclick="resetCanvas()">
<i class="fas fa-redo"></i> Reset
</button>
</div>
<script>
// Configuration
const config = {
particleCount: 100,
connectionDistance: 150,
mouseDistance: 200,
speed: 1,
mode: 'flow',
particlesEnabled: true,
colors: {
purple: { primary: '#6366f1', secondary: '#ec4899', accent: '#06b6d4' },
ocean: { primary: '#06b6d4', secondary: '#3b82f6', accent: '#6366f1' },
sunset: { primary: '#f59e0b', secondary: '#ef4444', accent: '#ec4899' },
forest: { primary: '#10b981', secondary: '#059669', accent: '#84cc16' }
}
};
let currentTheme = 'purple';
let particles = [];
let mouse = { x: null, y: null };
let animationId;
let lastTime = 0;
let frameCount = 0;
let fps = 60;
// Canvas Setup
const canvas = document.getElementById('particleCanvas');
const ctx = canvas.getContext('2d');
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// Particle Class
class Particle {
constructor() {
this.reset();
}
reset() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.size = Math.random() * 3 + 1;
this.speedX = (Math.random() - 0.5) * config.speed;
this.speedY = (Math.random() - 0.5) * config.speed;
this.life = Math.random() * 100;
this.maxLife = 100 + Math.random() * 100;
this.opacity = Math.random() * 0.5 + 0.2;
}
update() {
// Mode-based behavior
if (config.mode === 'flow') {
this.x += this.speedX;
this.y += this.speedY;
} else if (config.mode === 'chaos') {
this.x += (Math.random() - 0.5) * 5;
this.y += (Math.random() - 0.5) * 5;
} else if (config.mode === 'breathe') {
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
const angle = Math.atan2(this.y - centerY, this.x - centerX);
const distance = Math.sqrt((this.x - centerX) ** 2 + (this.y - centerY) ** 2);
const force = (200 - distance) / 200;
this.x += Math.cos(angle) * force * 0.5;
this.y += Math.sin(angle) * force * 0.5;
}
// Mouse interaction
if (mouse.x != null) {
const dx = mouse.x - this.x;
const dy = mouse.y - this.y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < config.mouseDistance) {
const force = (config.mouseDistance - distance) / config.mouseDistance;
const angle = Math.atan2(dy, dx);
if (config.mode === 'chaos') {
this.x -= Math.cos(angle) * force * 5;
this.y -= Math.sin(angle) * force * 5;
} else {
this.x += Math.cos(angle) * force * 2;
this.y += Math.sin(angle) * force * 2;
}
}
}
// Boundary check
if (this.x < 0 || this.x > canvas.width || this.y < 0 || this.y > canvas.height) {
if (config.mode !== 'breathe') {
this.reset();
}
}
this.life++;
if (this.life > this.maxLife) {
this.opacity -= 0.01;
if (this.opacity <= 0) this.reset();
}
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fillStyle = `rgba(255, 255, 255, ${this.opacity})`;
ctx.fill();
}
}
// Initialize Particles
function initParticles() {
particles = [];
for (let i = 0; i < config.particleCount; i++) {
particles.push(new Particle());
}
document.getElementById('particleCount').textContent = config.particleCount;
}
// Draw Connections
function drawConnections() {
for (let i = 0; i < particles.length; i++) {
for (let j = i + 1; j < particles.length; j++) {
const dx = particles[i].x - particles[j].x;
const dy = particles[i].y - particles[j].y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < config.connectionDistance) {
const opacity = (1 - distance / config.connectionDistance) * 0.2;
ctx.beginPath();
ctx.strokeStyle = `rgba(255, 255, 255, ${opacity})`;
ctx.lineWidth = 1;
ctx.moveTo(particles[i].x, particles[i].y);
ctx.lineTo(particles[j].x, particles[j].y);
ctx.stroke();
}
}
}
}
// Animation Loop
function animate(currentTime) {
// FPS Calculation
if (currentTime - lastTime >= 1000) {
fps = frameCount;
frameCount = 0;
lastTime = currentTime;
document.getElementById('fps').textContent = fps;
}
frameCount++;
ctx.clearRect(0, 0, canvas.width, canvas.height);
if (config.particlesEnabled) {
particles.forEach(particle => {
particle.update();
particle.draw();
});
drawConnections();
}
animationId = requestAnimationFrame(animate);
}
// Mouse Tracking
window.addEventListener('mousemove', (e) => {
mouse.x = e.x;
mouse.y = e.y;
});
window.addEventListener('mouseleave', () => {
mouse.x = null;
mouse.y = null;
});
// Touch support
window.addEventListener('touchmove', (e) => {
mouse.x = e.touches[0].clientX;
mouse.y = e.touches[0].clientY;
});
// Theme Management
function setTheme(theme) {
currentTheme = theme;
const colors = config.colors[theme];
const root = document.documentElement;
root.style.setProperty('--primary', colors.primary);
root.style.setProperty('--secondary', colors.secondary);
root.style.setProperty('--accent', colors.accent);
// Update mesh background
const meshBg = document.getElementById('meshBg');
meshBg.style.background = `
radial-gradient(circle at 20% 50%, ${colors.primary}40 0%, transparent 50%),
radial-gradient(circle at 80% 80%, ${colors.secondary}40 0%, transparent 50%),
radial-gradient(circle at 40% 20%, ${colors.accent}40 0%, transparent 50%),
var(--bg-dark)
`;
// Update UI
document.querySelectorAll('.color-btn').forEach(btn => {
btn.classList.remove('active');
if (btn.dataset.theme === theme) btn.classList.add('active');
});
}
// Mode Management
function setMode(mode) {
config.mode = mode;
document.getElementById('currentMode').textContent = mode.charAt(0).toUpperCase() + mode.slice(1);
// Update buttons
document.querySelectorAll('.controls .control-btn').forEach(btn => {
btn.classList.remove('active');
if (btn.textContent.toLowerCase().includes(mode)) {
btn.classList.add('active');
}
});
// Breathing mode specific
const circle = document.getElementById('breathingCircle');
const text = document.getElementById('breathingText');
if (mode === 'breathe') {
circle.style.animation = 'breathe 8s ease-in-out infinite';
text.textContent = 'Breathe';
config.particlesEnabled = true;
} else if (mode === 'chaos') {
circle.style.animation = 'none';
text.textContent = 'Chaos';
config.speed = 3;
particles.forEach(p => {
p.speedX = (Math.random() - 0.5) * config.speed;
p.speedY = (Math.random() - 0.5) * config.speed;
});
} else {
circle.style.animation = 'none';
text.textContent = 'Flow';
config.speed = 1;
particles.forEach(p => {
p.speedX = (Math.random() - 0.5) * config.speed;
p.speedY = (Math.random() - 0.5) * config.speed;
});
}
}
function toggleParticles() {
config.particlesEnabled = !config.particlesEnabled;
event.target.classList.toggle('active');
}
function resetCanvas() {
initParticles();
mouse.x = null;
mouse.y = null;
}
// Breathing Circle Interaction
let isBreathing = false;
document.getElementById('breathingCircle').addEventListener('click', function() {
if (isBreathing) return;
isBreathing = true;
const text = document.getElementById('breathingText');
this.classList.remove('inhale', 'exhale');
// Inhale
text.textContent = 'Inhale...';
this.classList.add('inhale');
setTimeout(() => {
// Hold
text.textContent = 'Hold...';
setTimeout(() => {
// Exhale
text.textContent = 'Exhale...';
this.classList.remove('inhale');
this.classList.add('exhale');
setTimeout(() => {
text.textContent = 'Breathe';
this.classList.remove('exhale');
isBreathing = false;
}, 4000);
}, 2000);
}, 4000);
});
// Initialize
window.addEventListener('load', () => {
setTimeout(() => {
document.getElementById('loader').classList.add('hidden');
}, 500);
initParticles();
animate(0);
});
// Prevent default touch behaviors for better mobile experience
document.addEventListener('touchmove', function(e) {
if (e.target === canvas) {
e.preventDefault();
}
}, { passive: false });
</script>
</body>
</html>