Exact sunflower seed placement at the golden angle, with the spiral families clearly visible.
Exact sunflower seed placement at the golden angle, with the spiral families clearly visible.
No runs posted yet. Be the first: post yours and tag @wikiwayne.
GOLDEN BLOOM: A Sunflower Grows by the Golden Angle
HOOK OBJECT: window.__bloom
Build "GOLDEN BLOOM": a giant sunflower head in Canvas 2D (no libraries) whose seeds are placed one at a time at the golden angle of 137.508 degrees, so a perfect crowd of spirals grows out from the center. Watching the seeds arrive is the whole show, and a small twist of the angle shows why this number is special.
LOOK
- Style: glowing botanical art on a deep dusk background, gradient #141B3A (top) to #2A1F3F (bottom). Petals: 21 long petals in #FFC93C with a lighter #FFE48A center stripe, arranged evenly around the flower. Seeds: small discs, colored by their order from #4A2E1A (center, early seeds) to #C98A3C (rim, late seeds), each with a tiny lighter highlight. A green stem #4F9D4A runs down off the bottom of the screen.
- Seed n (n = 1, 2, 3 ...) sits at distance r = c x sqrt(n) from the center and angle n x 137.508 degrees, where c is chosen so that seed 1597 sits at 38% of the screen height from the center. Each seed disc has a radius of 0.8 x c (diameter 1.6 x c), so neighboring seeds almost touch.
- A small label at the top-left: "GOLDEN BLOOM" plus the line "137.508 degrees", which changes to the real angle while it is nudged. Never over the flower.
- FIRST FRAME (t = 0, no input): the full 21-petal flower, centered, fills at least 70% of the screen height, with the first 89 seeds already in the center and a fresh seed visibly appearing every frame after that.
MOTION / PLAY
- Seeds are added at 60 per second, one at a time (at 60 fps, one seed per frame; use the game time so advance() adds exactly the same number). A new seed appears at the center and slides to its spot over 0.25 s while fading in. At 1,597 seeds growth stops (about 25.1 s after the bloom starts): the flower holds for 1.4 s with a gentle glow pulse, then every seed shrinks away over 1 s and the flower grows again from the 89 seeds. One bloom takes about 28 s. Seed positions are always computed from the formula above, so they are always exact.
- Controls: tap or click the flower (or press H) to cycle the highlight through "21 spirals", "34 spirals" and "off". "21 spirals" lights in bright #FFFFFF every seed whose number n has n mod 21 = 0 (a thin white spiral arm of seeds appears); "34 spirals" lights every seed with n mod 34 = 0. Press N (or tap the label) to nudge the angle to 137.0 degrees for 3 s (the spiral turns into a few ugly straight arms with gaps), then it eases back to 137.508 degrees. setView(zoom) zooms from 1x to 2.5x, centered on the flower.
- ATTRACT MODE: with no input, a hands-free demo starts on load and loops every 25–30 s, showing every main feature (growth, the 21 highlight at 12 s, the 34 highlight at 17 s, the angle nudge at 21 s, and the full bloom). Any input takes over; the demo resumes after 8 s with no input.
SOUND
- A very soft "pop" for every 10th seed, with the pitch rising as the flower grows.
- A warm swelling pad that rises with the seed count.
- A bell "ding" when the bloom reaches 1,597 seeds.
- A short two-note blip each time a highlight turns on, and a wobbly "uh-oh" slide while the angle is nudged.
COUNTERS
stats() returns { fps, seeds, blooms, highlights, nudges }.
- seeds: a cumulative count, not the number on screen: it starts at 0 on load (the first 89 seeds are not counted) and goes +1 exactly when a new seed appears at the center. It never goes down, even when the flower shrinks and regrows.
- blooms: +1 exactly when the number of seeds on screen reaches 1,597 and the glow pulse starts.
- highlights: +1 exactly when a spiral highlight turns on (21 or 34).
- nudges: +1 exactly when the angle has eased back to 137.508 degrees after a nudge.
- On screen: seeds and blooms in a small row at the bottom-left, readable in a paused frame and never over the flower.
CHECKS for ?test=1
With ?test=1, run an accelerated self-test that measures real positions and real events (not self-set flags) and logs "TEST n PASS" or "TEST n FAIL: reason" to the console and to window.__testResults. Expose getSeed(n) on the hook, returning { x, y, r, angleDeg } for seed n:
Each check starts from a fresh load; advance() steps in 1/60 s increments.
1. At t = 0 the flower (petals) is at least 70% of the screen height, and 89 seeds are already placed.
2. After advance(10), seeds has grown by exactly 600 (within 1), and getSeed(500) has r = c x sqrt(500) and an angle of 500 x 137.508 degrees (mod 360), both within 0.5 px / 0.1 degrees.
3. After advance(26) from the start of a bloom (1,597 seeds are reached at about 25.1 s), there are exactly 1,597 seeds on screen, blooms is 1, and no two seed centers are closer than 1.2 x c.
4. With the "21 spirals" highlight on at 1,597 seeds, exactly 76 seeds (within 1) are highlighted, all of them with n mod 21 = 0, and highlights goes up by 1.
5. After a nudge and its easing back, getSeed(500) is back at its exact old position within 0.5 px, nudges goes up by 1, and there are zero console errors.
KEEP IT SHORT
- Keep the whole file under about 1,500 lines (soft target) so you can write it in one pass and finish well inside 15 minutes.
- Save lines with helpers, loops and instancing, not by dropping features. Everything above must really work: no placeholders, no TODOs.
BUILD RULES (all required):
- Deliver ONE self-contained HTML file: inline CSS and JS, no build step, no local assets. Libraries only from a CDN. If you use Three.js, use exactly this import map: {"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/"}}
- It must open straight from disk in desktop Chrome and on an iPhone (Safari), fill the full screen, handle resize and touch, and stay smooth (target 60 fps).
- It must look stunning in the very FIRST frame: no black screen, no loading wait, no tiny subject. The main subject fills at least 50% of the screen height.
- SOUND (required): all sound is made in code with Web Audio (no audio files). Show a small "🔊 TAP FOR SOUND" chip; on the first tap create ONE AudioContext, route everything through a master gain of 0.6 into a DynamicsCompressor, and hide the chip. Also expose enableAudio() on the hook object named at the top.
- Expose the hook object named at the top with: setCameraOrbit(azimuthDeg, elevationDeg, distance) (or an equivalent camera setter), advance(seconds) that steps the simulation exactly that much for still captures, enableAudio(), and stats() returning {fps, ...the counters named above}. Use a fixed random seed of 360 so every run is the same.
- Every on-screen counter must count a real event you can see happen. No fake numbers.
- No text overlapping the subject; any label must be readable in a paused frame.
- No brand logos, no real people, no copyrighted characters, brand names or logos.
FAILURE MODES TO AVOID
- A blank page, or only the label on a blank page, because one script error stopped the scene.
- A tiny first frame where the flower is only a few seeds in the middle of a dark screen.
- Seeds placed with a rounded angle like 137 or 138 degrees, so you see straight arms instead of curved spirals.
- Seeds that overlap into a blob, or leave big gaps, because the radius does not follow the square-root rule.
- A growth rate that depends on the frame rate instead of on game time.
- Highlights that mark the wrong seeds, or counters that tick on a timer instead of the visible event.
- A label drawn over the flower.
- The same variable declared twice, or methods called on objects that don't exist yet.
SELF-TEST LOOP
- If you can run code: build the file, open it, read the console, run ?test=1, and take screenshots at 3 s, 10 s and 30 s at 1280x720 and 390x844. Look at the screenshots and fix what looks wrong. Fix and retest until all 5 checks pass with zero console errors. Mark anything you could not run as UNMEASURED; never invent results.
- If you are chat-only: go through this prompt line by line, check your code against each line, and fix anything that would fail. Then write one corrected, complete file.
- Final answer: ONE complete HTML file in ONE code block, then the 5 checks marked PASS, FAIL or UNMEASURED. No snippets, no "rest unchanged".
Built one? Post it on X and tag @wikiwaynePost on X