मुख्य सामग्री पर जाएँ
Skillpedia
एजेंट101k · #976

worker-visualizer

यह क्या करती है

आपके ब्राउज़र में एक विज़ुअल एनिमेशन बनाता है जो स्मूथ चलता है (60 फ्रेम प्रति सेकंड)। यह भारी गणनाएँ बैकग्राउंड में करता है, बिना मुख्य पेज को फ्रीज़ किए, और नतीजा कैनवास पर दिखाता है।

कब इस्तेमाल करें

  • ✓जब आप रियल-टाइम पार्टिकल या फिज़िक्स सिमुलेशन देखना चाहते हैं।
  • ✓मूविंग फ्रैक्टल जैसे जटिल विज़ुअल इफ़ेक्ट बनाने के लिए।
  • ✓ऐसी चीज़ विकसित करते समय जिसमें भारी गणना हो, पर इंटरफ़ेस धीमा न हो।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/nexu-io/open-design/blob/main/design-templates/worker-visualizer/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“1000 पार्टिकल्स का सिमुलेशन बनाओ जो एक-दूसरे को आकर्षित करें, और उसे कैनवास पर दिखाओ।”

हर हफ़्ते 5 नई skills, 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
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills