threejs-cinematic-loading-screen
Skill4 starsChanged 17 days agoMITView on GitHub
Builds a cinematic loading gate for a three.js scene — a painted CSS dawn (layered gradients, drifting blurred mist bands, optional conic god rays, SVG feTurbulence grain, vignette), a 2D-canvas layer of falling petals and glowing motes, a handwritten title that animates in, a gold progress line with stage captions, then "tap anywhere to enter" whose tap is the browser gesture that unlocks audio; uses a still captured from the live scene as the backdrop that cross-fades into the real render, and warms up shaders before lifting so the first interaction never stalls. Use when adding a loading screen, splash screen, intro curtain, preloader, tap-to-start / audio unlock gate or shader pre-compilation to a WebGL scene.
In this repository30 other files it gives its agents.
- threejs-blender-glb-pipelineSkill
- threejs-boat-buoyancy-steeringSkill
- threejs-camera-guided-tourSkill
- threejs-day-cycle-lightingSkill
- threejs-dreamy-glass-hudSkill
- threejs-first-person-bvh-walkSkill
- threejs-fish-school-boidsSkill
- threejs-floating-island-landmarkSkill
- threejs-ghibli-night-modeSkill
- threejs-ghibli-sky-cloudsSkill
- threejs-ghibli-toon-shadingSkill
- threejs-glb-realism-pipelineSkill
- threejs-gpu-butterfliesSkill
- threejs-headless-visual-verificationSkill
- threejs-hud-objective-markersSkill
- threejs-night-lights-lanternsSkill
- threejs-object-interactionSkill
- threejs-open-world-streamingSkill
- threejs-postprocessing-anime-gradeSkill
- threejs-procedural-vegetationSkill
- threejs-shell-fur-renderingSkill
- threejs-skeletonless-character-animationSkill
- threejs-stylized-rock-materialSkill
- threejs-webaudio-generative-soundtrackSkill
- threejs-webgl-performance-profilingSkill
- threejs-webgl-rain-effectSkill
- threejs-webgl-realistic-waterSkill
- threejs-webgl-underwater-effectSkill
- threejs-webgl-wake-simulationSkill
- threejs-webgl-waterfall-effectSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 55
Start every model and JSON fetch() from an inline script in <head>, before the scene module has even arrived, and report from there.
- Distinctive: line 80
Create night-only lights at build time with intensity 0 — adding a light later recompiles every material.
- Very specific: line 93
Don't start audio on page load.
- Distinctive: line 94
If the still and first live frame differ (camera moved, orbit started early), the reveal visibly jumps.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cinematic loading gate
The loading screen is a gate, not a spinner: a dawn over the scene with mist, petals and a handwritten title, a thin gold progress line, and — once everything is built, compiled and rendered behind it — "tap anywhere to enter". That tap starts the music (browsers only allow audio after a gesture), so no separate "tap to start sound" is needed. The backdrop is a still of the opening view captured from the live scene, which fades into the live render so the reveal has nothing to jump to.
Stack: plain HTML/CSS + one 2D canvas for particles, over a three.js WebGLRenderer. Works with any framework; in
R3F put the gate outside <Canvas> and flip classes from an onCreated/ready callback.
When to use
- Load takes more than a second or two (GLBs, textures, shader compiles).
- The scene has sound that needs a user gesture.
- The first dive/zoom/interaction hitches because shaders compile on that frame.
Paste-ready prompt
Replace the loading screen of
{{entry file}}with a cinematic gate: a layered CSS dawn (radial sun glow + banded sky gradient),{{optional: a slowly rotating repeating-conic-gradient masked to a disc for god rays}}, three blurred mist bands drifting on alternate animations, an SVG feTurbulence grain overlay, and a 2D canvas of petals and motes. The title animates letter-spacing .34em → .06em with a blur-in. A thin gold progress bar with stage captions. When loading completes the bar fades and "tap anywhere to enter" appears; that tap starts the music. Leave with opacity 0 + scale(1.06) + blur(8px). Use a still of the opening view captured from the live scene as the backdrop, cross-fade it into the live render when ready, and hide the HUD until entered. Before lifting the curtain, render one frame from each view that compiles new shaders (e.g. underwater) so the first interaction doesn't stall.?tourturns the gate text into "tap to start the tour".
Implementation
Layers (references/loading-gate.html)
Bottom to top: .shot (the captured still, background-size:cover, a 30 s scale drift 1.04 → 1.07) · .tint
gradient · .mist bands (filter:blur(18px), radial white gradients, 46 s / 63 s / 80 s translateX(±6%)
alternate) · <canvas id="loadFx"> petals + motes · .vignette · .grain (inline SVG feTurbulence
baseFrequency .9, numOctaves 2, opacity .06, mix-blend-mode:overlay) · intro text · progress bar · enter hint.
- Title: web handwriting font,
@keyframes titleIn { from { letter-spacing:.34em; filter:blur(6px); translateY(12px) } to { letter-spacing:.06em } }, 2.2 s with a .6 s delay; eyebrow / tagline / ruleriseInstaggered .3 s, 1.4 s, 1.8 s. - Particles: ~46 petals (pink/green hsla, rotate, "edge-on" thinning via a per-petal sine on y-scale and alpha) and
~70 rising motes with twinkle and
shadowBlur, DPR-aware; stop the loop when the gate leaves (__stopLoadFx). - Progress:
#bar iwidth transition .5 s, glowing dot at the tip; caption swaps with a fade (.swap). - The enter line:
text-align:center; width:max-content; max-width:88vw, with a small glowing dot above it that pings a ring every 2.4 s. Tagline and small print gettext-wrap:balance.
Honest progress
- One number for the whole preparation, weighted by where the time goes: downloads 60 %, model decoding 20 %, scene construction 10 %, shader compilation 9 %, first rendered frame 1 %. The caption names the stage ("downloading the scenery", "preparing the models", "building the scenery", "compiling the lighting", "finishing the first frame").
- Start every model and JSON
fetch()from an inline script in<head>, before the scene module has even arrived, and report from there. Per file: stream the body and count bytes when the response has a usableContent-Lengthand noContent-Encoding; otherwise count the file when it completes. Never invent bytes. - Clamp so it cannot go backwards and cannot show 100 % early:
last = max(last, min(.99, k)). - A failed load replaces the caption with a plain sentence and shows a Retry button; the particle loop stops.
- The backdrop still ships as AVIF / WebP / JPEG through
image-set(), with a portrait crop for tall screens (@media (max-aspect-ratio:3/4)): acoverfit on a phone otherwise shows only the middle of a wide still. - Web fonts must not hold the first paint: load the stylesheet with
media="print" onload="this.media='all'"anddisplay=swap.
States (references/enter-and-warmup.js)
body.loading→ HUD and wordmark hidden.#loading.ready→ bar/caption/percent fade out,.shotfades (1.6 s) so the live scene shows through the now-translucent curtain,.enterfades in and pulses.- Enter on
pointerdownorkeydownonly once.ready: add.leave(opacity 0, scale 1.06, blur 8 px, 1.4 s), removebody.loading, start auto-orbit (or the tour), remove the DOM after 1.5 s. - The HUD arrives after the curtain, not with it: add
body.enteringfor 3.2 s and give each HUD group atransition-delayunder it (counters 1.1 s, language 1.3 s, dock 1.5 s, wordmark 1.8 s). - The orbit starts only on enter, so the still and the live camera line up exactly.
?silentremoves the "sound on" promise;?tourrewrites the enter text and starts the tour instead.
Shader warm-up before the reveal
- Make the render loop a named
frame(). At the end ofbuild(), jump to each view that uses different programs (underwater: underwater pass, shafts, bubbles, the clipped mirror of the bed and fish), callframe()twice, then return to the opening view and render once — all behind the curtain. - Measured with a
?nowarmswitch: first dive 163 ms cold → 10 ms warmed. - Create night-only lights at build time with intensity 0 — adding a light later recompiles every material.
Capturing the backdrop still
- Render a frame with
frame()and callcanvas.toBlobin the same task (the drawing buffer is cleared before the next frame, not after this one), POST it to a throwaway local receiver, downscale:sips -Z 1600 in.png --setProperty format jpeg --setProperty formatOptions 68 --out public/loading.jpg(~500 KB). - Re-capture after any change to the opening view.
Pitfalls
- The main thread blocks for seconds while shaders compile at load; automation (MCP/CDP) calls time out in that window — wait ~15 s before probing.
- A dev server may cache
index.html; after edits navigate with?v=N. - Don't start audio on page load; only the gate's tap (or first pointer/key anywhere) may call
AudioContext.resume(). - If the still and first live frame differ (camera moved, orbit started early), the reveal visibly jumps.
hiddenattributes lose to authordisplay:rules; hide with body classes or[hidden]{display:none}.- A block centred with
left:50%; transform:translateX(-50%)still holds left-aligned lines: "tap anywhere to enter" sat left of the longer small print beneath it until the block gottext-align:center. - On a 390 px screen,
.3em-tracked uppercase small print wraps into a ragged stack; drop it to.2em/ 10 px and balance it. - Petals and motes are soft, blurred shapes: cap the particle canvas at 1.5× DPR and scale the count with the screen area, or a 3× phone clears and blurs ~3 megapixels a frame while the scene is trying to build.
Verify
- Throttle the network: captions progress, the bar never goes backwards, the gate waits at 100 %.
- The cross-fade from still to live shows no jump.
- First dive/first interaction after entering: no hitch (compare with
?nowarm). - Audio starts on the entering tap;
?silentstays silent;?tourstarts the tour from that tap. - Phone portrait: title scales (
clamp(56px, 11vmin, 104px)), nothing overflows, the enter line and its small print share one centre line. - Kill the network mid-load: the caption explains, Retry appears, the bar does not sit at a false 99 %.
Related skills
threejs-webaudio-generative-soundtrack · threejs-camera-guided-tour · threejs-hud-objective-markers · threejs-dreamy-glass-hud · threejs-webgl-performance-profiling · threejs-headless-visual-verification
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

