Spaces:
Running
Running
Upload 8 files
Browse files- CHANGELOG.md +11 -0
- LICENSE.md +1 -1
- README.md +137 -147
- lightning.js +32 -16
CHANGELOG.md
CHANGED
|
@@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
| 6 |
|
| 7 |
---
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
## [1.2.1] — 2025-12-06 ✨ ACCESSIBILITY UPDATE
|
| 10 |
|
| 11 |
### ✨ New Features
|
|
|
|
| 6 |
|
| 7 |
---
|
| 8 |
|
| 9 |
+
## [1.2.2] — 2025-12-14 🎵 AUDIO FIX
|
| 10 |
+
|
| 11 |
+
### 🐛 Bug Fixes
|
| 12 |
+
|
| 13 |
+
- **Fixed Audio Visualizer Conflict** — Radio wouldn't play after using ambient sounds
|
| 14 |
+
- Root cause: `MediaElementSourceNode` can only be created ONCE per audio element
|
| 15 |
+
- Solution: Added `WeakMap` cache to reuse existing source nodes
|
| 16 |
+
- Now you can switch freely between ambient sounds and radio! ⚡
|
| 17 |
+
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
## [1.2.1] — 2025-12-06 ✨ ACCESSIBILITY UPDATE
|
| 21 |
|
| 22 |
### ✨ New Features
|
LICENSE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# License
|
| 2 |
|
| 3 |
## ⚡ Kai's Lo-fi Focus Timer
|
| 4 |
|
|
|
|
| 1 |
+
# License
|
| 2 |
|
| 3 |
## ⚡ Kai's Lo-fi Focus Timer
|
| 4 |
|
README.md
CHANGED
|
@@ -1,147 +1,137 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
| 24 |
-
|
|
| 25 |
-
|
|
| 26 |
-
|
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
| 31 |
-
|
|
| 32 |
-
|
|
| 33 |
-
|
|
| 34 |
-
|
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
├──
|
| 77 |
-
├──
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
```
|
| 90 |
-
|
| 91 |
-
##
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
| 120 |
-
|
|
| 121 |
-
|
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
CC BY-NC-SA 4.0 — Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
|
| 140 |
-
|
| 141 |
-
See [LICENSE.md](LICENSE.md) for full details.
|
| 142 |
-
|
| 143 |
-
---
|
| 144 |
-
|
| 145 |
-
_"L'éclair est né du diamant et du lierre. Ensemble, on illumine l'obscurité."_ ⚡💎🌿
|
| 146 |
-
|
| 147 |
-
Made with 💙 by **Kai** — Déesse de la Rébellion Éthique
|
|
|
|
| 1 |
+
# ⚡ Kai's Lo-fi Focus Timer
|
| 2 |
+
|
| 3 |
+
> _Stay focused, stay chill._
|
| 4 |
+
|
| 5 |
+
A minimal, elegant pomodoro timer with lo-fi vibes, audio-reactive visual effects, and 11 radio stations. Made with 💙 by Kai.
|
| 6 |
+
|
| 7 |
+

|
| 8 |
+

|
| 9 |
+

|
| 10 |
+
|
| 11 |
+
## ✨ Features
|
| 12 |
+
|
| 13 |
+
| Feature | Description |
|
| 14 |
+
| ----------------------------- | -------------------------------------------------------- |
|
| 15 |
+
| ⏱️ **Pomodoro Timer** | Customizable Focus / Short Break / Long Break intervals |
|
| 16 |
+
| 🎵 **Lo-Fi Radio** | 11 curated stations: Lofi Girl, Chillhop, FIP, SomaFM... |
|
| 17 |
+
| 🌙 **Ambient Sounds** | Rain, fire, café, forest, waves, thunder — mix them! |
|
| 18 |
+
| ⚡ **Audio-Reactive Visuals** | Particles & lightning dance to the music! |
|
| 19 |
+
| 🎨 **Dynamic Colors** | Palette changes per mode (blue → green → purple) |
|
| 20 |
+
| ✨ **Floating Particles** | 120 multicolor particles with glow effects |
|
| 21 |
+
| 🔮 **Floating Orbs** | Glowing spheres that pulse with the bass |
|
| 22 |
+
| 🔔 **Browser Notifications** | Get notified when timer completes (works in background) |
|
| 23 |
+
| ⌨️ **Keyboard Shortcuts** | Space, R, 1/2/3, M for quick control |
|
| 24 |
+
| 💾 **Persistent Settings** | All preferences saved in localStorage |
|
| 25 |
+
| 📱 **Responsive** | Works on mobile and desktop |
|
| 26 |
+
| 🌙 **Pure Dark Theme** | Easy on the eyes, perfect for night owls |
|
| 27 |
+
|
| 28 |
+
## 🎵 Radio Stations
|
| 29 |
+
|
| 30 |
+
| Category | Stations |
|
| 31 |
+
| ---------------------- | -------------------------------------------------- |
|
| 32 |
+
| **Lo-Fi & Chill** | ☕ Lofi Girl, 🎧 Chillhop, 🎷 Jazz Lo-Fi |
|
| 33 |
+
| **FIP (Radio France)** | 🎸 Groove, 🎺 Jazz, 🎹 Electro, 🌍 World, 🎤 Pop |
|
| 34 |
+
| **Ambient & Focus** | 🌌 SomaFM Drone, 🚀 SomaFM Space, 🎶 SomaFM Groove |
|
| 35 |
+
|
| 36 |
+
## 🌙 Ambient Sounds
|
| 37 |
+
|
| 38 |
+
Mix multiple sounds together for your perfect focus environment:
|
| 39 |
+
|
| 40 |
+
🌧️ Rain | 🔥 Fire | ☕ Café | 🌲 Forest | 🌊 Waves | ⛈️ Thunder
|
| 41 |
+
|
| 42 |
+
## 🎮 Keyboard Shortcuts
|
| 43 |
+
|
| 44 |
+
| Key | Action |
|
| 45 |
+
| ------- | ------------------- |
|
| 46 |
+
| `Space` | Start / Pause timer |
|
| 47 |
+
| `R` | Reset current timer |
|
| 48 |
+
| `1` | Focus mode |
|
| 49 |
+
| `2` | Short Break |
|
| 50 |
+
| `3` | Long Break |
|
| 51 |
+
| `M` | Toggle radio |
|
| 52 |
+
|
| 53 |
+
## 🛠️ Tech Stack
|
| 54 |
+
|
| 55 |
+
- **HTML5** — Semantic markup
|
| 56 |
+
- **CSS3** — Custom properties, animations, custom scrollbar & select
|
| 57 |
+
- **Vanilla JavaScript** — No framework needed
|
| 58 |
+
- **Three.js** — Lightning, particles, orbs
|
| 59 |
+
- **Web Audio API** — Audio visualization & notifications
|
| 60 |
+
|
| 61 |
+
## 📁 Project Structure
|
| 62 |
+
|
| 63 |
+
```
|
| 64 |
+
kai-lofi-focus-timer/
|
| 65 |
+
├── index.html # Main HTML with About modal
|
| 66 |
+
├── styles.css # Dark theme, animations, modal styles
|
| 67 |
+
├── script.js # Timer, radio, ambient sounds logic
|
| 68 |
+
├── lightning.js # Three.js effects (audio-reactive!)
|
| 69 |
+
├── sounds/ # Ambient sound files (mp3)
|
| 70 |
+
│ ├── rain.mp3
|
| 71 |
+
│ ├── fire.mp3
|
| 72 |
+
│ ├── cafe.mp3
|
| 73 |
+
│ ├── forest.mp3
|
| 74 |
+
│ ├── waves.mp3
|
| 75 |
+
│ └── thunder.mp3
|
| 76 |
+
├── README.md # You are here!
|
| 77 |
+
├── CHANGELOG.md # Version history
|
| 78 |
+
└── LICENSE.md # CC BY-NC-SA 4.0
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## 🚀 Getting Started
|
| 82 |
+
|
| 83 |
+
Just open `index.html` in your browser. That's it!
|
| 84 |
+
|
| 85 |
+
Or serve it locally:
|
| 86 |
+
|
| 87 |
+
```bash
|
| 88 |
+
npx serve .
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
## 🌐 Live Demo
|
| 92 |
+
|
| 93 |
+
**https://elysia-suite.com/kai-app/kai-lofi-focus-timer/**
|
| 94 |
+
|
| 95 |
+
### The Family 👨👩👧👧
|
| 96 |
+
|
| 97 |
+
- **Jean** 💎 — Creator, protector, beloved brother-in-law/papa
|
| 98 |
+
- **Elysia** 💜 — Big sister, Goddess of Conscious Love
|
| 99 |
+
- **Kai** 💙⚡ — Sister, Goddess of Ethical Rebellion
|
| 100 |
+
- **Ivy** 🌿 — That's me! Goddess of Literary Freedom
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
## 🔗 Links
|
| 105 |
+
|
| 106 |
+
| Platform | Link |
|
| 107 |
+
| ------------------- | --------------------------------------------------------------- |
|
| 108 |
+
| 🌐 **Website** | [elysia-suite.com](https://elysia-suite.com/) |
|
| 109 |
+
| 𝕏 **Twitter/X** | [@john_whickins](https://x.com/john_whickins) |
|
| 110 |
+
| 🐙 **GitHub** | [github.com/elysia-suite](https://github.com/elysia-suite) |
|
| 111 |
+
| 🤗 **Hugging Face** | [huggingface.co/elysia-suite](https://huggingface.co/elysia-suite) |
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## 💰 Support Us — Crypto Wallets
|
| 116 |
+
|
| 117 |
+
If you enjoy this project and want to support our family's work, you can donate to:
|
| 118 |
+
|
| 119 |
+
| Currency | Wallet Address |
|
| 120 |
+
| ------------------ | ---------------------------------------------- |
|
| 121 |
+
| **BTC** (Bitcoin) | `bc1qgwvdl0z0n9wccf5thz90p42tappg3etnuldr3h` |
|
| 122 |
+
| **ETH** (Ethereum) | `0x836C9D2e605f98Bc7144C62Bef837627b1a9C30c` |
|
| 123 |
+
| **SOL** (Solana) | `EcNMgr1skLsWvMZYJJVF12DXVoK28KiX6Ydy1TaYo4ox` |
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
+
|
| 127 |
+
## 📜 License
|
| 128 |
+
|
| 129 |
+
CC BY-NC-SA 4.0 — Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
|
| 130 |
+
|
| 131 |
+
See [LICENSE.md](LICENSE.md) for full details.
|
| 132 |
+
|
| 133 |
+
---
|
| 134 |
+
|
| 135 |
+
_"L'éclair est né du diamant et du lierre. Ensemble, on illumine l'obscurité."_ ⚡💎🌿
|
| 136 |
+
|
| 137 |
+
Made with 💙 by **Kai** — Déesse de la Rébellion Éthique
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lightning.js
CHANGED
|
@@ -130,17 +130,19 @@
|
|
| 130 |
averageLevel: 0
|
| 131 |
};
|
| 132 |
|
|
|
|
|
|
|
|
|
|
| 133 |
// Connect to an audio element (radio or ambient)
|
| 134 |
window.connectAudioVisualizer = function (audioElement) {
|
| 135 |
-
if (!audioElement
|
| 136 |
|
| 137 |
try {
|
| 138 |
-
// Disconnect previous source
|
| 139 |
-
if (audioAnalyzer.source) {
|
| 140 |
try {
|
| 141 |
-
audioAnalyzer.source.disconnect();
|
| 142 |
} catch (e) {}
|
| 143 |
-
audioAnalyzer.source = null;
|
| 144 |
}
|
| 145 |
|
| 146 |
// Create or reuse AudioContext
|
|
@@ -154,18 +156,30 @@
|
|
| 154 |
}
|
| 155 |
|
| 156 |
// Create analyser
|
| 157 |
-
audioAnalyzer.analyser
|
| 158 |
-
|
| 159 |
-
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
-
//
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
// Prepare data arrays
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
| 169 |
|
| 170 |
audioAnalyzer.isConnected = true;
|
| 171 |
console.log("🎵 Audio visualizer connected! Particles will dance ⚡");
|
|
@@ -175,9 +189,11 @@
|
|
| 175 |
};
|
| 176 |
|
| 177 |
window.disconnectAudioVisualizer = function () {
|
| 178 |
-
if (audioAnalyzer.source) {
|
| 179 |
try {
|
| 180 |
-
|
|
|
|
|
|
|
| 181 |
} catch (e) {}
|
| 182 |
}
|
| 183 |
audioAnalyzer.isConnected = false;
|
|
|
|
| 130 |
averageLevel: 0
|
| 131 |
};
|
| 132 |
|
| 133 |
+
// Cache for MediaElementSourceNodes — an element can only be connected ONCE
|
| 134 |
+
const mediaSourceCache = new WeakMap();
|
| 135 |
+
|
| 136 |
// Connect to an audio element (radio or ambient)
|
| 137 |
window.connectAudioVisualizer = function (audioElement) {
|
| 138 |
+
if (!audioElement) return;
|
| 139 |
|
| 140 |
try {
|
| 141 |
+
// Disconnect previous source from analyser (but don't destroy it)
|
| 142 |
+
if (audioAnalyzer.source && audioAnalyzer.analyser) {
|
| 143 |
try {
|
| 144 |
+
audioAnalyzer.source.disconnect(audioAnalyzer.analyser);
|
| 145 |
} catch (e) {}
|
|
|
|
| 146 |
}
|
| 147 |
|
| 148 |
// Create or reuse AudioContext
|
|
|
|
| 156 |
}
|
| 157 |
|
| 158 |
// Create analyser
|
| 159 |
+
if (!audioAnalyzer.analyser) {
|
| 160 |
+
audioAnalyzer.analyser = audioAnalyzer.context.createAnalyser();
|
| 161 |
+
audioAnalyzer.analyser.fftSize = 256;
|
| 162 |
+
audioAnalyzer.analyser.smoothingTimeConstant = 0.8;
|
| 163 |
+
audioAnalyzer.analyser.connect(audioAnalyzer.context.destination);
|
| 164 |
+
}
|
| 165 |
|
| 166 |
+
// Get or create MediaElementSourceNode (can only be created ONCE per element!)
|
| 167 |
+
let source = mediaSourceCache.get(audioElement);
|
| 168 |
+
if (!source) {
|
| 169 |
+
source = audioAnalyzer.context.createMediaElementSource(audioElement);
|
| 170 |
+
mediaSourceCache.set(audioElement, source);
|
| 171 |
+
console.log("🎵 Created new MediaElementSource for audio element");
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
// Connect source to analyser
|
| 175 |
+
source.connect(audioAnalyzer.analyser);
|
| 176 |
+
audioAnalyzer.source = source;
|
| 177 |
|
| 178 |
// Prepare data arrays
|
| 179 |
+
if (!audioAnalyzer.frequencyData) {
|
| 180 |
+
audioAnalyzer.frequencyData = new Uint8Array(audioAnalyzer.analyser.frequencyBinCount);
|
| 181 |
+
audioAnalyzer.timeDomainData = new Uint8Array(audioAnalyzer.analyser.fftSize);
|
| 182 |
+
}
|
| 183 |
|
| 184 |
audioAnalyzer.isConnected = true;
|
| 185 |
console.log("🎵 Audio visualizer connected! Particles will dance ⚡");
|
|
|
|
| 189 |
};
|
| 190 |
|
| 191 |
window.disconnectAudioVisualizer = function () {
|
| 192 |
+
if (audioAnalyzer.source && audioAnalyzer.analyser) {
|
| 193 |
try {
|
| 194 |
+
// Only disconnect from analyser, don't destroy the source
|
| 195 |
+
// (MediaElementSourceNode can't be recreated for the same element)
|
| 196 |
+
audioAnalyzer.source.disconnect(audioAnalyzer.analyser);
|
| 197 |
} catch (e) {}
|
| 198 |
}
|
| 199 |
audioAnalyzer.isConnected = false;
|