Aller au contenu
Skillpedia
Sites et interfaces (frontend)7.2k · #13429

fire-paper-loader

Ce qu’il fait

Ce skill guide un agent IA pour créer un écran de chargement avec un anneau de papier en feu, dessiné dans un worker en arrière-plan. Il s'adresse aux sites qui chargent des pages lourdes et ont besoin d'un chargement qui reste animé.

Quand l’utiliser

  • ✓Quand une page met du temps à charger et que l'écran de chargement doit rester animé.
  • ✓Quand vous voulez une intro spectaculaire de papier qui brûle et qui se fond dans la page.
  • ✓Quand un écran de chargement risquerait de se figer pendant que la page principale est occupée.

Lien du skill

https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/fire-paper-loader/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/fire-paper-loader/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Crée un écran de chargement en papier qui brûle et qui continue de s'animer même quand la page est occupée à charger.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent lance un worker en arrière-plan depuis l'en-tête de la page, qui dessine la flamme sur son propre canevas, donc l'animation continue pendant que la page principale est bloquée. Un compteur de progression et un fondu doux mènent ensuite à la page.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Fire-Paper Loader

A ring of burning paper opens on black while the page builds. The mechanism: the fire is drawn by a Worker on an OffscreenCanvas that is started from <head>, so the ring keeps burning while the main thread is blocked for hundreds of milliseconds. The flame look is staging; a loader that stops dead for 450 ms reads as a hang whatever it looks like.

Nearest skills: web-design-performance covers general page speed; this one is specifically a loader that survives a blocked thread. For the burning-paper look on scroll transitions (not a loader), the flame GLSL is the same kbFlame but the page draws it. For a spinner or AI-status orb, use thinking-orbs.

Stack, verified in the source: Vanilla JavaScript, raw WebGL 1 (GLSL ES 1.00, no Three.js in the loader), Worker plus OffscreenCanvas, CSS for the label and fade.

Start from the head, not from the body

Symptom: the loader appears 1-2 s late, or the worker never gets a GL context, or the fire stands still while three.js downloads. A worker can start and create its WebGL context only while the main thread is free, which is during stylesheet loading in <head> and not again until the page is parsed.

  • In a <script> in <head>: create a canvas, transferControlToOffscreen(), start a Worker from a Blob URL of a tiny boot script, post {kbPre, canvas} and call getContext('webgl', {antialias:false, alpha:false, depth:false, stencil:false}) in the worker there and then. Keep the canvas and worker on window.__kbPre.
  • The boot script is only a shell. The loader's own <script> (later in the body) sends its own textContent to the worker with {kbInit, src, canvas:null, t0, origin: performance.timeOrigin, reduced, view, target}, and the worker evals it. One source text runs on both threads: const IN_W = typeof document === 'undefined'. Two copies drift apart.
  • Guard every step: no Worker, no OffscreenCanvas, no transferControlToOffscreen, worker onerror, or a fail message means draw on the main thread with the same code after the same warm-up.
  • Convert clocks. The worker's performance.now() differs from the page's: send performance.timeOrigin, and add performance.timeOrigin - origin in the worker so every timestamp the page reads is its own.

Compile in parallel, warm the pipeline, then show

Symptom: the first visible frames are the slowest of the load (30-130 ms, once 408 ms on Metal).

  1. Create both programs (ring, cinders), attach shaders, linkProgram both, and only then ask for status. With KHR_parallel_shader_compile the driver compiles on its own threads; reading COMPILE_STATUS per shader defeats it. Skip the per-shader check when the extension exists.
  2. warmUp(): run a real frame's draws of both programs into a 1x1 viewport, then readPixels 1 pixel, waited. A first draw builds the GPU pipeline; make that happen before anything is seen.
  3. Only then start requestAnimationFrame. The page's LOAD.ready() resolves when the worker draws (typically 0.15-0.3 s, timed out at 1.2 s); the build awaits it so it does not hold the thread off for a second while the fire stands still.
  4. Show one canvas, not two. Drawing the fire on both threads first cost compile time in the first visible frames.

The ring's pace is planned in what is seen

Symptom: the coal sits at one size for a second, then leaps 2.5x; or a ring that stalls is overtaken by a faster one and reads as two fires.

  • Plan the growth in S = gain + ln(radius / first radius), not in the raw progress u. Equal steps in S look like equal growth at every size. The fade-in weighs 0.3 in S (at 1 it held the size back for 0.9 s).
  • Follow S with a critically damped spring (omega 5/s, speed clamped to 1.6/s, integrated in 1/120 s sub-steps) toward a goal that is the real progress but never behind a creep: creep = 0.38*(1 - exp(-t/800 ms)), and the goal cannot pass WAIT 0.290 while waiting, easing toward CEIL 0.335 with a 2.5 s time constant. A hard hold and progress arriving in lumps read as a ring parked, then shoved.
  • Never still: minimum VMIN 0.016/s (about 5 px a frame at 8 fps), maximum VMAX 0.05/s. The seen radius: a 4 px fleck at progress 0, 5.8 px by 0.15, then the burn's own radius.
  • Before the page has said anything, progress creeps on its own clock, so the ring lives while three.js is still on the wire.

Hand off without a stall

Symptom: the ring lurches into the page's intro, or the page stutters for 55-240

Questions fréquentes

Pourquoi utiliser un worker ?

Un worker s'exécute séparément de la page principale, donc la flamme continue de bouger même quand la page est bloquée.

Couvre-t-il la vitesse générale de la page ?

Non. Le skill indique qu'un autre skill général couvre la vitesse des pages. Celui-ci concerne uniquement l'écran de chargement.

Quel type de code utilise-t-il ?

Il utilise du JavaScript simple et WebGL, sans grande bibliothèque 3D.

Détails

Description originale de l’auteur

Build a burning-paper ring loader whose GLSL flame is drawn by a Worker on an OffscreenCanvas started from the head, so a main thread blocked by the page build cannot freeze it, with a progress count, an even-paced run into the hand-off, and a clean fade to the page. Covers the ember thread and ember gradient, porous char, worker start-up, parallel shader compile with a waited 1-px warm-up draw, hand-off without a stall, reduced motion and hidden-tab behaviour. Use for a loading screen, preloader, page loader, splash, "kindling", burn loader, ember ring, burning paper hole, fire loader, or a l

repo: MengTo/Skills

Popularité

Étoiles GitHub
7.2k
Position au classement
#13429
Licence
MIT
Mis à jour
01/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires