Chuyển đến nội dung
Skillpedia
Hình ảnh và biểu tượng101k · #1061

webgl-particle-galaxy

Skill này làm gì

Tạo hoạt ảnh trực quan ấn tượng gồm hàng nghìn điểm sáng xoay cùng nhau, như một thiên hà. Tất cả chạy trực tiếp trong trình duyệt mà không cần tải thêm gì.

Khi nào nên dùng

  • ✓Khi bạn muốn tạo nền hoạt hình tương lai cho website.
  • ✓Khi bạn muốn thể hiện các hiệu ứng hình ảnh phức tạp trên một trang web.
  • ✓Khi bạn cần một yếu tố hình ảnh bắt mắt và có tính kỹ thuật cao.

Liên kết skill

https://github.com/nexu-io/open-design/blob/main/plugins/_official/examples/webgl-particle-galaxy/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/nexu-io/open-design/blob/main/plugins/_official/examples/webgl-particle-galaxy/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo thiên hà hạt đang xoay làm nền cho website của tôi.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Nó dùng công nghệ WebGL để vẽ hàng nghìn điểm trực tiếp trên card đồ họa của máy tính. Các điểm chuyển động theo quỹ đạo được tính toán theo thời gian thực, tạo hiệu ứng thiên hà.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Particle Galaxy Skill

Produce a single self-contained index.html that renders a real-time particle system full-screen, with a clean typographic overlay on top. The signature move: compute each particle's position on the GPU so the CPU never loops over particles.

Why this is a powered artifact

OpenDesign detects getContext('webgl2') and renders this file in powered preview — a cross-origin-isolated iframe with allow-same-origin. The full GPU pipeline is available; you do not need to work around the opaque sandbox.

Resource map

webgl-particle-galaxy/
├── SKILL.md      ← you're reading this
└── example.html  ← a working 50,000-point WebGL2 galaxy (READ FIRST)

Workflow

Step 0 — Read the reference

Read example.html end to end. Note the shape: no vertex buffer — the vertex shader reads gl_VertexID, hashes it into a stable per-particle seed, and derives a log-spiral orbit with an inner-fast rotation curve. Points are drawn with gl.drawArrays(gl.POINTS, 0, N) in one call, additive-blended (blendFunc(ONE, ONE) with premultiplied color) so overlapping points glow.

Step 1 — Pick the motion

Choose a field the vertex shader can express cheaply from gl_VertexID + uTime:

  • Spiral galaxy (default): log-spiral arms, rotation curve speed ≈ k / (r + ε), thin disk.
  • Attractor / flow: curl or a strange-attractor step baked as a closed-form function of time.
  • Explosion / reform: interpolate between a seeded start and a target shape on a looping clock.

Step 2 — Build index.html

  • One file, zero external requests. Bind a VAO even with no attributes (some drivers require it).
  • Point size in the vertex shader (gl_PointSize), clamped and DPR-aware; soft round sprites via gl_PointCoord + a gaussian falloff in the fragment shader.
  • Additive blending on a dark clear color; premultiply the fragment color so blendFunc(ONE, ONE) reads as glow, not double-exposure.
  • Compile shaders with error logging (getShaderInfoLog / getProgramInfoLog) so a typo fails loudly.

Step 3 — Overlay + brand

  • Map the accent colors to the active DESIGN.md when one is present; otherwise a restrained dark palette with one vivid accent (the reference uses lime #63fe13 for the arms and a white-blue core).
  • Headline ≤ 15ch plus one supporting line. Never bury the particles behind the text.

Step 4 — Self-review (P0)

  • Renders continuously at ~60fps; the FPS badge updates.
  • Tens of thousands of points in a single draw call (no per-particle CPU loop).
  • No WebGL console errors; program links cleanly.
  • Resizes crisply on window resize (no stretching / blur).
  • Degrades to a message (not a blank page) if webgl2 is unavailable.
Câu hỏi thường gặp

“Particles” trong ngữ cảnh này là gì?

Chúng chỉ là những chấm sáng hoặc màu nhỏ, khi kết hợp lại tạo thành hình ảnh thiên hà.

Tại sao nó nhanh?

Vì việc tính chuyển động cho mỗi điểm được thực hiện bởi card đồ họa (GPU), nhanh hơn nhiều so với bộ xử lý chính (CPU) cho loại tác vụ này.

Tôi có cần cài đặt gì không?

Không, mọi thứ chạy trực tiếp trong trình duyệt web hiện đại của bạn.

Chi tiết

Mô tả gốc của tác giả

A real-time particle galaxy — tens of thousands of additive-blended GPU points spiraling around a bright core, their orbits solved entirely in the vertex shader (from gl_VertexID), so the whole cloud draws in one call. Rendered as a single self-contained `index.html`. Use when the brief asks for a "particle field", "particle galaxy", "point cloud", "instanced points", "starfield", "GPU particles",

repo: nexu-io/open-design

Độ phổ biến

Sao GitHub
101k
Vị trí xếp hạng
#1061
Giấy phép
Apache-2.0
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự