Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>AquaWork - Welcome</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> | |
| <script src="https://unpkg.com/lucide@latest/dist/umd/lucide.js"></script> | |
| <style> | |
| :root { | |
| --bg-primary: #0a0a0b; | |
| --bg-secondary: #141416; | |
| --bg-tertiary: #1c1c1f; | |
| --text-primary: rgba(255, 255, 255, 0.95); | |
| --text-secondary: rgba(255, 255, 255, 0.7); | |
| --text-tertiary: rgba(255, 255, 255, 0.5); | |
| --glass-bg: rgba(255, 255, 255, 0.05); | |
| --glass-border: rgba(255, 255, 255, 0.1); | |
| --glass-highlight: rgba(255, 255, 255, 0.15); | |
| --accent-glow: rgba(120, 200, 255, 0.3); | |
| --accent-primary: rgba(100, 180, 255, 0.8); | |
| --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4); | |
| --shadow-glow: 0 0 40px rgba(100, 180, 255, 0.15); | |
| --radius-sm: 12px; | |
| --radius-md: 20px; | |
| --radius-lg: 28px; | |
| --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1); | |
| } | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| html { | |
| font-size: 16px; | |
| } | |
| body { | |
| font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; | |
| background: var(--bg-primary); | |
| color: var(--text-primary); | |
| min-height: 100vh; | |
| overflow: hidden; | |
| -webkit-font-smoothing: antialiased; | |
| -moz-osx-font-smoothing: grayscale; | |
| } | |
| /* Shooting Stars Background */ | |
| .background-container { | |
| position: fixed; | |
| inset: 0; | |
| z-index: 0; | |
| overflow: hidden; | |
| } | |
| .gradient-bg { | |
| position: absolute; | |
| inset: 0; | |
| background: | |
| radial-gradient(ellipse 80% 50% at 50% -20%, rgba(60, 80, 120, 0.3) 0%, transparent 50%), | |
| radial-gradient(ellipse 60% 40% at 80% 100%, rgba(40, 60, 100, 0.2) 0%, transparent 40%), | |
| radial-gradient(ellipse 50% 30% at 10% 80%, rgba(50, 70, 110, 0.15) 0%, transparent 35%), | |
| linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%); | |
| } | |
| .ambient-glow { | |
| position: absolute; | |
| width: 300px; | |
| height: 300px; | |
| border-radius: 50%; | |
| filter: blur(80px); | |
| opacity: 0.4; | |
| animation: ambientPulse 8s ease-in-out infinite; | |
| } | |
| .glow-1 { | |
| top: 20%; | |
| left: 10%; | |
| background: radial-gradient(circle, rgba(100, 150, 200, 0.3) 0%, transparent 70%); | |
| animation-delay: 0s; | |
| } | |
| .glow-2 { | |
| bottom: 30%; | |
| right: 15%; | |
| background: radial-gradient(circle, rgba(80, 130, 180, 0.25) 0%, transparent 70%); | |
| animation-delay: 3s; | |
| } | |
| .glow-3 { | |
| top: 60%; | |
| left: 50%; | |
| background: radial-gradient(circle, rgba(90, 140, 190, 0.2) 0%, transparent 70%); | |
| animation-delay: 5s; | |
| } | |
| @keyframes ambientPulse { | |
| 0%, 100% { transform: scale(1); opacity: 0.3; } | |
| 50% { transform: scale(1.2); opacity: 0.5; } | |
| } | |
| #shooting-stars { | |
| position: absolute; | |
| inset: 0; | |
| pointer-events: none; | |
| } | |
| /* Main Content */ | |
| .app-container { | |
| position: relative; | |
| z-index: 1; | |
| min-height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| padding: 24px; | |
| transform-style: preserve-3d; | |
| perspective: 1000px; | |
| } | |
| /* Header Link */ | |
| .header-link { | |
| position: fixed; | |
| top: 20px; | |
| left: 50%; | |
| transform: translateX(-50%); | |
| z-index: 100; | |
| font-size: 0.75rem; | |
| color: var(--text-tertiary); | |
| text-decoration: none; | |
| padding: 8px 16px; | |
| background: var(--glass-bg); | |
| border: 1px solid var(--glass-border); | |
| border-radius: 100px; | |
| backdrop-filter: blur(10px); | |
| -webkit-backdrop-filter: blur(10px); | |
| transition: all 0.3s var(--transition-smooth); | |
| } | |
| .header-link:hover { | |
| color: var(--text-primary); | |
| background: rgba(255, 255, 255, 0.08); | |
| border-color: var(--glass-highlight); | |
| } | |
| /* Welcome Card */ | |
| .welcome-card { | |
| width: 100%; | |
| max-width: 420px; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| gap: 40px; | |
| animation: fadeInUp 1s var(--transition-smooth) forwards; | |
| opacity: 0; | |
| } | |
| @keyframes fadeInUp { | |
| from { | |
| opacity: 0; | |
| transform: translateY(30px); | |
| } | |
| to { | |
| opacity: 1; | |
| transform: translateY(0); | |
| } | |
| } | |
| /* Logo Section */ | |
| .logo-section { | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| gap: 16px; | |
| } | |
| .logo-container { | |
| position: relative; | |
| width: 80px; | |
| height: 80px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| animation: logoFloat 6s ease-in-out infinite; | |
| } | |
| @keyframes logoFloat { | |
| 0%, 100% { transform: translateY(0) rotate(0deg); } | |
| 25% { transform: translateY(-8px) rotate(2deg); } | |
| 75% { transform: translateY(4px) rotate(-1deg); } | |
| } | |
| .logo-glass { | |
| position: absolute; | |
| inset: 0; | |
| background: linear-gradient(135deg, | |
| rgba(255, 255, 255, 0.1) 0%, | |
| rgba(255, 255, 255, 0.05) 50%, | |
| rgba(255, 255, 255, 0.02) 100%); | |
| border: 1px solid var(--glass-highlight); | |
| border-radius: 24px; | |
| backdrop-filter: blur(20px); | |
| -webkit-backdrop-filter: blur(20px); | |
| box-shadow: | |
| var(--shadow-soft), | |
| inset 0 1px 0 rgba(255, 255, 255, 0.1), | |
| 0 0 40px rgba(100, 180, 255, 0.1); | |
| } | |
| .logo-icon { | |
| position: relative; | |
| z-index: 1; | |
| width: 40px; | |
| height: 40px; | |
| color: var(--accent-primary); | |
| filter: drop-shadow(0 0 12px rgba(100, 180, 255, 0.5)); | |
| } | |
| .logo-ring { | |
| position: absolute; | |
| inset: -4px; | |
| border: 1px solid rgba(100, 180, 255, 0.2); | |
| border-radius: 28px; | |
| animation: ringPulse 3s ease-in-out infinite; | |
| } | |
| @keyframes ringPulse { | |
| 0%, 100% { transform: scale(1); opacity: 0.5; } | |
| 50% { transform: scale(1.05); opacity: 0.8; } | |
| } | |
| /* Title Section */ | |
| .title-section { | |
| text-align: center; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 12px; | |
| } | |
| .app-title { | |
| font-size: clamp(2.5rem, 8vw, 3.5rem); | |
| font-weight: 700; | |
| letter-spacing: -0.03em; | |
| background: linear-gradient(135deg, | |
| var(--text-primary) 0%, | |
| rgba(180, 210, 255, 0.9) 50%, | |
| var(--text-primary) 100%); | |
| background-size: 200% 200%; | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| background-clip: text; | |
| animation: titleShimmer 4s ease-in-out infinite; | |
| text-shadow: 0 0 60px rgba(100, 180, 255, 0.3); | |
| } | |
| @keyframes titleShimmer { | |
| 0%, 100% { background-position: 0% 50%; } | |
| 50% { background-position: 100% 50%; } | |
| } | |
| .app-tagline { | |
| font-size: clamp(0.9rem, 3vw, 1.1rem); | |
| font-weight: 400; | |
| color: var(--text-secondary); | |
| letter-spacing: 0.02em; | |
| line-height: 1.5; | |
| max-width: 280px; | |
| } | |
| /* Buttons Section */ | |
| .buttons-section { | |
| width: 100%; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 16px; | |
| } | |
| /* Glass Button */ | |
| .glass-button { | |
| position: relative; | |
| width: 100%; | |
| padding: 18px 28px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| gap: 12px; | |
| font-family: inherit; | |
| font-size: 1rem; | |
| font-weight: 600; | |
| letter-spacing: 0.01em; | |
| color: var(--text-primary); | |
| background: linear-gradient(135deg, | |
| rgba(255, 255, 255, 0.08) 0%, | |
| rgba(255, 255, 255, 0.04) 100%); | |
| border: 1px solid var(--glass-border); | |
| border-radius: var(--radius-md); | |
| backdrop-filter: blur(20px); | |
| -webkit-backdrop-filter: blur(20px); | |
| cursor: pointer; | |
| overflow: hidden; | |
| transition: all 0.4s var(--transition-smooth); | |
| box-shadow: var(--shadow-soft); | |
| } | |
| .glass-button::before { | |
| content: ''; | |
| position: absolute; | |
| inset: 0; | |
| background: linear-gradient(135deg, | |
| rgba(255, 255, 255, 0.1) 0%, | |
| transparent 50%); | |
| opacity: 0; | |
| transition: opacity 0.3s var(--transition-smooth); | |
| } | |
| .glass-button::after { | |
| content: ''; | |
| position: absolute; | |
| inset: -2px; | |
| background: linear-gradient(135deg, | |
| rgba(100, 180, 255, 0.3) 0%, | |
| transparent 50%, | |
| transparent 100%); | |
| border-radius: inherit; | |
| z-index: -1; | |
| opacity: 0; | |
| transition: opacity 0.3s var(--transition-smooth); | |
| } | |
| .glass-button:hover { | |
| transform: translateY(-2px) scale(1.02); | |
| border-color: var(--glass-highlight); | |
| box-shadow: | |
| var(--shadow-soft), | |
| var(--shadow-glow); | |
| } | |
| .glass-button:hover::before { | |
| opacity: 1; | |
| } | |
| .glass-button:hover::after { | |
| opacity: 1; | |
| } | |
| .glass-button:active { | |
| transform: translateY(0) scale(0.98); | |
| transition-duration: 0.1s; | |
| } | |
| .glass-button:focus-visible { | |
| outline: 2px solid var(--accent-primary); | |
| outline-offset: 2px; | |
| } | |
| /* Primary Button */ | |
| .glass-button.primary { | |
| background: linear-gradient(135deg, | |
| rgba(100, 180, 255, 0.15) 0%, | |
| rgba(80, 150, 220, 0.1) 100%); | |
| border-color: rgba(100, 180, 255, 0.3); | |
| animation: buttonBreath 4s ease-in-out infinite; | |
| } | |
| @keyframes buttonBreath { | |
| 0%, 100% { box-shadow: var(--shadow-soft), 0 0 20px rgba(100, 180, 255, 0.1); } | |
| 50% { box-shadow: var(--shadow-soft), 0 0 35px rgba(100, 180, 255, 0.2); } | |
| } | |
| .glass-button.primary::after { | |
| background: linear-gradient(135deg, | |
| rgba(100, 180, 255, 0.4) 0%, | |
| rgba(80, 150, 220, 0.2) 50%, | |
| transparent 100%); | |
| } | |
| .glass-button.primary:hover { | |
| border-color: rgba(100, 180, 255, 0.5); | |
| } | |
| /* Secondary Button */ | |
| .glass-button.secondary { | |
| background: linear-gradient(135deg, | |
| rgba(255, 255, 255, 0.05) 0%, | |
| rgba(255, 255, 255, 0.02) 100%); | |
| } | |
| /* Button Icon */ | |
| .button-icon { | |
| width: 20px; | |
| height: 20px; | |
| flex-shrink: 0; | |
| transition: transform 0.3s var(--transition-smooth); | |
| } | |
| .glass-button:hover .button-icon { | |
| transform: scale(1.1); | |
| } | |
| .glass-button.primary .button-icon { | |
| color: var(--accent-primary); | |
| filter: drop-shadow(0 0 8px rgba(100, 180, 255, 0.5)); | |
| } | |
| .glass-button.secondary .button-icon { | |
| color: var(--text-secondary); | |
| } | |
| /* Button Ripple Effect */ | |
| .ripple { | |
| position: absolute; | |
| border-radius: 50%; | |
| background: rgba(255, 255, 255, 0.3); | |
| transform: scale(0); | |
| animation: rippleEffect 0.6s linear; | |
| pointer-events: none; | |
| } | |
| @keyframes rippleEffect { | |
| to { | |
| transform: scale(4); | |
| opacity: 0; | |
| } | |
| } | |
| /* Footer */ | |
| .footer-section { | |
| margin-top: 40px; | |
| text-align: center; | |
| opacity: 0; | |
| animation: fadeIn 1s var(--transition-smooth) 0.5s forwards; | |
| } | |
| @keyframes fadeIn { | |
| to { opacity: 1; } | |
| } | |
| .footer-text { | |
| font-size: 0.8rem; | |
| color: var(--text-tertiary); | |
| letter-spacing: 0.02em; | |
| } | |
| /* Version Badge */ | |
| .version-badge { | |
| display: inline-flex; | |
| align-items: center; | |
| gap: 6px; | |
| margin-top: 8px; | |
| padding: 6px 14px; | |
| font-size: 0.7rem; | |
| font-weight: 500; | |
| color: var(--text-tertiary); | |
| background: var(--glass-bg); | |
| border: 1px solid var(--glass-border); | |
| border-radius: 100px; | |
| backdrop-filter: blur(10px); | |
| -webkit-backdrop-filter: blur(10px); | |
| } | |
| .version-dot { | |
| width: 6px; | |
| height: 6px; | |
| background: rgba(100, 200, 150, 0.8); | |
| border-radius: 50%; | |
| animation: dotPulse 2s ease-in-out infinite; | |
| } | |
| @keyframes dotPulse { | |
| 0%, 100% { opacity: 0.6; transform: scale(1); } | |
| 50% { opacity: 1; transform: scale(1.2); } | |
| } | |
| /* Modal Overlay */ | |
| .modal-overlay { | |
| position: fixed; | |
| inset: 0; | |
| z-index: 200; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| padding: 24px; | |
| background: rgba(0, 0, 0, 0.7); | |
| backdrop-filter: blur(10px); | |
| -webkit-backdrop-filter: blur(10px); | |
| opacity: 0; | |
| visibility: hidden; | |
| transition: all 0.3s var(--transition-smooth); | |
| } | |
| .modal-overlay.active { | |
| opacity: 1; | |
| visibility: visible; | |
| } | |
| .modal-content { | |
| width: 100%; | |
| max-width: 360px; | |
| padding: 32px; | |
| background: linear-gradient(135deg, | |
| rgba(30, 30, 35, 0.95) 0%, | |
| rgba(20, 20, 25, 0.98) 100%); | |
| border: 1px solid var(--glass-border); | |
| border-radius: var(--radius-lg); | |
| text-align: center; | |
| transform: scale(0.9) translateY(20px); | |
| transition: transform 0.3s var(--transition-smooth); | |
| box-shadow: | |
| 0 25px 50px rgba(0, 0, 0, 0.5), | |
| inset 0 1px 0 rgba(255, 255, 255, 0.05); | |
| } | |
| .modal-overlay.active .modal-content { | |
| transform: scale(1) translateY(0); | |
| } | |
| .modal-icon { | |
| width: 48px; | |
| height: 48px; | |
| margin: 0 auto 20px; | |
| color: var(--accent-primary); | |
| filter: drop-shadow(0 0 15px rgba(100, 180, 255, 0.4)); | |
| } | |
| .modal-title { | |
| font-size: 1.25rem; | |
| font-weight: 600; | |
| margin-bottom: 12px; | |
| } | |
| .modal-text { | |
| font-size: 0.9rem; | |
| color: var(--text-secondary); | |
| line-height: 1.6; | |
| margin-bottom: 24px; | |
| } | |
| .modal-button { | |
| width: 100%; | |
| padding: 14px 24px; | |
| font-family: inherit; | |
| font-size: 0.95rem; | |
| font-weight: 600; | |
| color: var(--text-primary); | |
| background: linear-gradient(135deg, | |
| rgba(100, 180, 255, 0.2) 0%, | |
| rgba(80, 150, 220, 0.15) 100%); | |
| border: 1px solid rgba(100, 180, 255, 0.3); | |
| border-radius: var(--radius-md); | |
| cursor: pointer; | |
| transition: all 0.3s var(--transition-smooth); | |
| } | |
| .modal-button:hover { | |
| background: linear-gradient(135deg, | |
| rgba(100, 180, 255, 0.25) 0%, | |
| rgba(80, 150, 220, 0.2) 100%); | |
| border-color: rgba(100, 180, 255, 0.5); | |
| transform: translateY(-1px); | |
| } | |
| /* Responsive */ | |
| @media (max-width: 480px) { | |
| .app-container { | |
| padding: 20px; | |
| } | |
| .welcome-card { | |
| gap: 32px; | |
| } | |
| .logo-container { | |
| width: 70px; | |
| height: 70px; | |
| } | |
| .glass-button { | |
| padding: 16px 24px; | |
| font-size: 0.95rem; | |
| } | |
| .header-link { | |
| font-size: 0.7rem; | |
| padding: 6px 12px; | |
| } | |
| } | |
| @media (min-width: 768px) { | |
| .welcome-card { | |
| max-width: 480px; | |
| } | |
| .buttons-section { | |
| flex-direction: row; | |
| } | |
| .glass-button { | |
| flex: 1; | |
| } | |
| } | |
| /* Reduced Motion */ | |
| @media (prefers-reduced-motion: reduce) { | |
| *, *::before, *::after { | |
| animation-duration: 0.01ms ; | |
| animation-iteration-count: 1 ; | |
| transition-duration: 0.01ms ; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <!-- Background --> | |
| <div class="background-container"> | |
| <div class="gradient-bg"></div> | |
| <div class="ambient-glow glow-1"></div> | |
| <div class="ambient-glow glow-2"></div> | |
| <div class="ambient-glow glow-3"></div> | |
| <canvas id="shooting-stars"></canvas> | |
| </div> | |
| <!-- Header Link --> | |
| <a href="https://huggingface.co/spaces/akhaliq/anycoder" | |
| class="header-link" | |
| target="_blank" | |
| rel="noopener noreferrer"> | |
| Built with anycoder | |
| </a> | |
| <!-- Main Content --> | |
| <main class="app-container" id="app-container"> | |
| <div class="welcome-card"> | |
| <!-- Logo Section --> | |
| <div class="logo-section"> | |
| <div class="logo-container"> | |
| <div class="logo-glass"></div> | |
| <div class="logo-ring"></div> | |
| <svg class="logo-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"> | |
| <path d="M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z"/> | |
| <path d="M12 8v8"/> | |
| <path d="M8 12h8"/> | |
| </svg> | |
| </div> | |
| </div> | |
| <!-- Title Section --> | |
| <div class="title-section"> | |
| <h1 class="app-title">AquaWork</h1> | |
| <p class="app-tagline">Focus in calm waves. Work in clean bursts.</p> | |
| </div> | |
| <!-- Buttons Section --> | |
| <div class="buttons-section"> | |
| <button class="glass-button primary" id="start-btn" aria-label="Start Pomodoro Timer"> | |
| <svg class="button-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | |
| <circle cx="12" cy="12" r="10"/> | |
| <polyline points="12 6 12 12 16 14"/> | |
| </svg> | |
| <span>Start Pomodoro</span> | |
| </button> | |
| <button class="glass-button secondary" id="learn-btn" aria-label="Learn More about AquaWork"> | |
| <svg class="button-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | |
| <path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/> | |
| <path d="M19 3v4"/> | |
| <path d="M21 5h-4"/> | |
| </svg> | |
| <span>Learn More</span> | |
| </button> | |
| </div> | |
| <!-- Footer --> | |
| <div class="footer-section"> | |
| <p class="footer-text">Your mindful productivity companion</p> | |
| <div class="version-badge"> | |
| <span class="version-dot"></span> | |
| <span>Version 2.0</span> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Modal --> | |
| <div class="modal-overlay" id="modal-overlay"> | |
| <div class="modal-content"> | |
| <svg class="modal-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"> | |
| <circle cx="12" cy="12" r="10"/> | |
| <polyline points="12 6 12 12 16 14"/> | |
| </svg> | |
| <h2 class="modal-title">Ready to Focus?</h2> | |
| <p class="modal-text">Your Pomodoro session is about to begin. Stay focused, take breaks, and achieve your goals with AquaWork.</p> | |
| <button class="modal-button" id="modal-close">Begin Session</button> | |
| </div> | |
| </div> | |
| <script> | |
| // Initialize variables first | |
| const canvas = document.getElementById('shooting-stars'); | |
| const ctx = canvas.getContext('2d'); | |
| let width = 0; | |
| let height = 0; | |
| let stars = []; | |
| let animationId = null; | |
| // Shooting Stars Configuration | |
| const STAR_CONFIG = { | |
| count: 60, | |
| minSpeed: 1, | |
| maxSpeed: 4, | |
| minSize: 0.5, | |
| maxSize: 2, | |
| trailLength: 15, | |
| angle: Math.PI / 4 | |
| }; | |
| // Star class | |
| class Star { | |
| constructor() { | |
| this.reset(); | |
| } | |
| reset() { | |
| const safeWidth = Math.max(width, 100); | |
| const safeHeight = Math.max(height, 100); | |
| this.x = Math.random() * safeWidth * 1.5; | |
| this.y = -Math.random() * safeHeight * 0.5; | |
| this.speed = STAR_CONFIG.minSpeed + Math.random() * (STAR_CONFIG.maxSpeed - STAR_CONFIG.minSpeed); | |
| this.size = Math.max(0.5, STAR_CONFIG.minSize + Math.random() * (STAR_CONFIG.maxSize - STAR_CONFIG.minSize)); | |
| this.opacity = 0.3 + Math.random() * 0.7; | |
| this.trail = []; | |
| this.maxTrail = Math.floor(5 + Math.random() * STAR_CONFIG.trailLength); | |
| } | |
| update() { | |
| const safeWidth = Math.max(width, 100); | |
| const safeHeight = Math.max(height, 100); | |
| this.trail.unshift({ x: this.x, y: this.y }); | |
| if (this.trail.length > this.maxTrail) { | |
| this.trail.pop(); | |
| } | |
| this.x += Math.cos(STAR_CONFIG.angle) * this.speed; | |
| this.y += Math.sin(STAR_CONFIG.angle) * this.speed; | |
| if (this.x > safeWidth + 100 || this.y > safeHeight + 100) { | |
| this.reset(); | |
| } | |
| } | |
| draw() { | |
| if (!ctx) return; | |
| // Draw trail | |
| for (let i = 0; i < this.trail.length; i++) { | |
| const point = this.trail[i]; | |
| const trailOpacity = (1 - i / this.trail.length) * this.opacity * 0.5; | |
| const trailSize = Math.max(0.1, this.size * (1 - i / this.trail.length)); | |
| ctx.beginPath(); | |
| ctx.arc(point.x, point.y, trailSize, 0, Math.PI * 2); | |
| ctx.fillStyle = `rgba(180, 210, 255, ${trailOpacity})`; | |
| ctx.fill(); | |
| } | |
| // Draw main star with glow | |
| const gradient = ctx.createRadialGradient( | |
| this.x, this.y, 0, | |
| this.x, this.y, Math.max(1, this.size * 3) | |
| ); | |
| gradient.addColorStop(0, `rgba(255, 255, 255, ${this.opacity})`); | |
| gradient.addColorStop(0.5, `rgba(180, 210, 255, ${this.opacity * 0.5})`); | |
| gradient.addColorStop(1, 'rgba(180, 210, 255, 0)'); | |
| ctx.beginPath(); | |
| ctx.arc(this.x, this.y, Math.max(1, this.size * 3), 0, Math.PI * 2); | |
| ctx.fillStyle = gradient; | |
| ctx.fill(); | |
| // Core | |
| ctx.beginPath(); | |
| ctx.arc(this.x, this.y, Math.max(0.5, this.size), 0, Math.PI * 2); | |
| ctx.fillStyle = `rgba(255, 255, 255, ${this.opacity})`; | |
| ctx.fill(); | |
| } | |
| } | |
| // Initialize canvas | |
| function initCanvas() { | |
| width = window.innerWidth; | |
| height = window.innerHeight; | |
| canvas.width = width; | |
| canvas.height = height; | |
| // Initialize stars | |
| stars = []; | |
| for (let i = 0; i < STAR_CONFIG.count; i++) { | |
| stars.push(new Star()); | |
| } | |
| } | |
| // Animation loop | |
| function animate() { | |
| if (!ctx) return; | |
| ctx.clearRect(0, 0, width, height); | |
| for (const star of stars) { | |
| star.update(); | |
| star.draw(); | |
| } | |
| animationId = requestAnimationFrame(animate); | |
| } | |
| // Check for reduced motion preference | |
| const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; | |
| // Start animation | |
| initCanvas(); | |
| if (!prefersReducedMotion) { | |
| animate(); | |
| } | |
| // Resize handler | |
| let resizeTimeout; | |
| window.addEventListener('resize', () => { | |
| clearTimeout(resizeTimeout); | |
| resizeTimeout = setTimeout(() => { | |
| initCanvas(); | |
| }, 100); | |
| }); | |
| // Parallax effect | |
| const appContainer = document.getElementById('app-container'); | |
| if (!prefersReducedMotion && appContainer) { | |
| document.addEventListener('mousemove', (e) => { | |
| const x = (e.clientX - window.innerWidth / 2) / 50; | |
| const y = (e.clientY - window.innerHeight / 2) / 50; | |
| appContainer.style.transform = `translateX(${x}px) translateY(${y}px)`; | |
| }); | |
| } | |
| // Button ripple effect | |
| function createRipple(event, button) { | |
| const existingRipples = button.querySelectorAll('.ripple'); | |
| existingRipples.forEach(ripple => ripple.remove()); | |
| const ripple = document.createElement('span'); | |
| ripple.classList.add('ripple'); | |
| const rect = button.getBoundingClientRect(); | |
| const size = Math.max(rect.width, rect.height); | |
| ripple.style.width = ripple.style.height = `${size}px`; | |
| ripple.style.left = `${event.clientX - rect.left - size / 2}px`; | |
| ripple.style.top = `${event.clientY - rect.top - size / 2}px`; | |
| button.appendChild(ripple); | |
| setTimeout(() => ripple.remove(), 600); | |
| } | |
| // Button handlers | |
| const startBtn = document.getElementById('start-btn'); | |
| const learnBtn = document.getElementById('learn-btn'); | |
| const modalOverlay = document.getElementById('modal-overlay'); | |
| const modalClose = document.getElementById('modal-close'); | |
| if (startBtn) { | |
| startBtn.addEventListener('click', (e) => { | |
| createRipple(e, startBtn); | |
| setTimeout(() => { | |
| if (modalOverlay) { | |
| modalOverlay.classList.add('active'); | |
| } | |
| }, 200); | |
| }); | |
| } | |
| if (learnBtn) { | |
| learnBtn.addEventListener('click', (e) => { | |
| createRipple(e, learnBtn); | |
| setTimeout(() => { | |
| window.open('http://aquawork.netlify.app/', '_blank', 'noopener,noreferrer'); | |
| }, 200); | |
| }); | |
| } | |
| if (modalClose) { | |
| modalClose.addEventListener('click', () => { | |
| if (modalOverlay) { | |
| modalOverlay.classList.remove('active'); | |
| } | |
| }); | |
| } | |
| if (modalOverlay) { | |
| modalOverlay.addEventListener('click', (e) => { | |
| if (e.target === modalOverlay) { | |
| modalOverlay.classList.remove('active'); | |
| } | |
| }); | |
| } | |
| // Keyboard accessibility | |
| document.addEventListener('keydown', (e) => { | |
| if (e.key === 'Escape' && modalOverlay && modalOverlay.classList.contains('active')) { | |
| modalOverlay.classList.remove('active'); | |
| } | |
| }); | |
| // Touch feedback for mobile | |
| const allButtons = document.querySelectorAll('.glass-button'); | |
| allButtons.forEach(button => { | |
| button.addEventListener('touchstart', () => { | |
| button.style.transform = 'scale(0.98)'; | |
| }, { passive: true }); | |
| button.addEventListener('touchend', () => { | |
| button.style.transform = ''; | |
| }, { passive: true }); | |
| }); | |
| </script> | |
| </body> | |
| </html> |