Aller au contenu
Skillpedia
Agents101k · #976

worker-visualizer

Ce qu’il fait

Crée une animation visuelle fluide (60 fps) dans votre navigateur. Elle effectue les calculs lourds en arrière-plan sans bloquer la page principale et affiche le résultat dans un canvas.

Quand l’utiliser

  • ✓Quand vous voulez voir des simulations de particules ou de physique en temps réel.
  • ✓Pour créer des effets visuels complexes, comme des fractales animées.
  • ✓Quand vous développez quelque chose qui demande un calcul intensif sans ralentir l'interface.

Lien du skill

https://github.com/nexu-io/open-design/blob/main/design-templates/worker-visualizer/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/nexu-io/open-design/blob/main/design-templates/worker-visualizer/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 une simulation de 1000 particules qui s'attirent mutuellement et affiche-la dans un canvas.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Le code répartit le travail : une partie gère les calculs lourds dans une zone séparée (Web Worker), et l'autre se contente d'afficher le résultat à l'écran. La page reste ainsi réactive.

Contenu technique (SKILL.md original)

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

Worker Visualizer Skill

Produce a single self-contained index.html that moves heavy per-frame compute into a Web Worker and renders the result to a canvas, keeping the main thread at a smooth 60fps.

Why this is a powered artifact

OpenDesign detects new Worker( / SharedArrayBuffer / OffscreenCanvas and renders this file in powered preview — a cross-origin-isolated iframe with allow-same-origin. That means external and blob Web Workers construct successfully, SharedArrayBuffer is defined (crossOriginIsolated === true), and importScripts works. In the old opaque sandbox all three failed; here they just work.

Resource map

worker-visualizer/
├── SKILL.md      ← you're reading this
└── example.html  ← a working 12k-particle SharedArrayBuffer sim (READ FIRST)

Workflow

Step 0 — Read the reference

Read example.html. Note the split: the worker integrates positions each tick; the main thread only reads + draws. It feature-detects crossOriginIsolated and uses a SharedArrayBuffer for zero-copy when available, falling back to a transferable postMessage copy otherwise. Always ship that fallback so the artifact still animates if isolation is off.

Step 1 — Choose the workload

Pick ONE compute-bound job worth offloading:

  • Particle / N-body field (default): thousands of bodies with a cheap force law.
  • Fractal: Mandelbrot/Julia escape-time into an ImageData buffer.
  • Cellular automata / reaction-diffusion: grid updated in the worker.
  • Data/audio visualizer: transform a stream into bars/rings each frame.

Step 2 — Build index.html

  • One file, zero external requests. Build the worker from a Blob + URL.createObjectURL (inline its source), or embed it as a data: URL.
  • Prefer SharedArrayBuffer for large per-frame state: allocate on the main thread, pass the SharedArrayBuffer to the worker, and read the same Float32Array/Uint8ClampedArray view while drawing. Guard on typeof SharedArrayBuffer !== 'undefined' && crossOriginIsolated.
  • Fallback path: if not isolated, postMessage a transferable ArrayBuffer each frame.
  • Consider OffscreenCanvas + canvas.transferControlToOffscreen() to render inside the worker for the heaviest scenes.

Step 3 — Overlay + brand

  • HUD with the title and 2–3 live stat tiles (particle count, transport mode, fps). Map accent color to the active DESIGN.md when present; otherwise a dark ground with one vivid accent.

Step 4 — Self-review (P0)

  • Worker constructs with no SecurityError; sim runs.
  • Main-thread render holds ~60fps under the full workload.
  • SharedArrayBuffer path engages when crossOriginIsolated is true; postMessage fallback engages otherwise — verify BOTH branches degrade cleanly.
  • No unbounded growth: velocities/positions stay stable over minutes.
  • The "Transport" stat truthfully reports which path is live.
Questions fréquentes

Qu'est-ce qu'un « Web Worker » ?

C'est comme un assistant discret du navigateur qui effectue les tâches lourdes sans gêner ce que vous voyez sur l'écran principal.

Qu'est-ce que « SharedArrayBuffer » ?

C'est une méthode avancée pour partager de très gros volumes de données entre la partie principale et l'assistant (Web Worker) sans tout recopier, ce qui est plus rapide.

Pourquoi l'animation tourne-t-elle à 60 fps ?

L'outil est conçu pour optimiser les calculs et le dessin, afin que l'animation soit fluide et agréable à regarder, comme dans un jeu vidéo.

Détails

Description originale de l’auteur

A real-time data/particle/simulation visualizer whose heavy compute runs in a Web Worker (off the main thread), optionally sharing memory with the UI via SharedArrayBuffer, and renders to a canvas at 60fps. Produced as a single self-contained `index.html`. Use when the brief asks for a "web worker", "simulation", "particle system", "physics", "off-main-thread", "fractal", "real-time compute", or "

repo: nexu-io/open-design

Popularité

Étoiles GitHub
101k
Position au classement
#976
Licence
Apache-2.0
Mis à jour
15/10/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires