본문으로 건너뛰기
Skillpedia
에이전트101k · #976

worker-visualizer

하는 일

브라우저에서 부드럽게(초당 60프레임) 실행되는 시각 애니메이션을 만듭니다. 무거운 계산은 백그라운드에서 수행해 메인 페이지를 멈추지 않고, 결과는 캔버스에 표시합니다.

사용하는 경우

  • ✓실시간 입자나 물리 시뮬레이션을 보고 싶을 때.
  • ✓움직이는 프랙털 같은 복잡한 시각 효과를 만들 때.
  • ✓인터페이스를 느리게 하지 않고 많은 계산이 필요한 것을 개발할 때.

스킬 링크

https://github.com/nexu-io/open-design/blob/main/design-templates/worker-visualizer/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/nexu-io/open-design/blob/main/design-templates/worker-visualizer/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“서로 끌어당기는 입자 1000개의 시뮬레이션을 만들어 캔버스에 표시해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

코드는 작업을 나눕니다. 한 부분은 별도 영역(Web Worker)에서 무거운 계산을 처리하고, 다른 부분은 결과를 화면에 그립니다. 이렇게 해서 페이지가 계속 반응하도록 합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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.
자주 묻는 질문

'Web Worker'는 무엇인가요?

메인 화면을 방해하지 않고 무거운 작업을 처리하는, 브라우저 안의 보이지 않는 도우미와 같습니다.

'SharedArrayBuffer'는 무엇인가요?

메인 부분과 도우미(Web Worker) 사이에 매우 큰 데이터를 전부 복사하지 않고 공유하는 고급 방식으로, 더 빠르게 만들어 줍니다.

애니메이션은 왜 60fps로 실행되나요?

계산과 그리기를 최적화해 애니메이션이 부드럽고 보기 좋도록 설계되었으며, 게임처럼 매끄럽게 동작합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
101k
순위
#976
라이선스
Apache-2.0
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬