Skill library

Agent skill Web motion

WebGL Laser

Create a visual effect for a web page or interactive component.

  • Visual effects

Install the skill

Installation method

Run the command from your project root with Node.js and npm.

npx skills@latest add https://github.com/MengTo/Skills/tree/main/agent-skills/web-design/webgl-laser --skill webgl-laser --agent claude-code --yes

Check this file in your project.claude/skills/webgl-laser/SKILL.md

Other ways to install
  • Choose an assistant interactively

    npx skills@latest add https://github.com/MengTo/Skills/tree/main/agent-skills/web-design/webgl-laser --skill webgl-laser

    Select your assistant and choose the project installation scope.

    Official instructions

The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. Use a dark page, one CSS accent color, and a fixed decorative canvas. The source uses raw WebGL 1 and GLSL ES for a full-screen quad.

View operation manual

What this skill helps with

  • Create a visual effect for a web page or interactive component.

Good for

  • Interactive visual effects
Publisher
Meng To
Runtime
WebGL 1 · GLSL ES · CSS fallback
Bundled example
The bundled reference wrapper expects shared runtimes absent from the installed Skill. Use demo/preview.jpg and the portable shader recipe in SKILL.md.
Skill name
webgl-laser
Repository
MengTo/Skills

Common pitfall

Avoid this prompt

Start another RAF loop from every resize and place the canvas above the foreground.

Frame callbacks accumulate across resize events, and a canvas in the foreground can intercept clicks intended for the content.

Use these steps

  1. Inspect the demo and target
  2. Apply the runtime recipe
  3. Verify the browser behavior

Project walkthrough

Draw a narrow accent beam for an original background while keeping the text and foreground controls readable.

Draw a narrow accent beam for an original background while keeping the text and foreground controls readable.

  1. Inspect the demo and target

    The bundled reference wrapper expects shared runtimes absent from the installed Skill. Use demo/preview.jpg and the portable shader recipe in SKILL.md.

    Prompt · Step 1
    Use WebGL Laser on [my observatory exhibition page]. Open demo/preview.jpg for reference and read the Raw WebGL Setup and Initializer in SKILL.md. Map the site accent to the halo and keep the foreground copy and links in HTML. Place a fixed canvas behind the content and choose a beam position that leaves the text area dark.
  2. Apply the runtime recipe

    Draw a narrow accent beam for an original background while keeping the text and foreground controls readable.

    Prompt · Step 2
    Compile the WebGL 1 quad shader and keep the near-white core, accent halo, and localized smoke as separate controls. Resize the drawing buffer and u_resolution together, with maxDpr 1.5 for this fixture. For a descending vignette use 1.0 - smoothstep(0.18, 1.25, length(p)) so the edges remain ordered. Keep one frame loop across resizes, freeze u_time in reduced motion, retain a CSS fallback on WebGL failure, and release the program, buffers, and frame callback on teardown. Set pointer-events: none on the decorative canvas.
  3. Verify the browser behavior

    The beam core draws brighter than the distant edge without blocking foreground links.

    • The beam core draws brighter than the distant edge without blocking foreground links.
    • The drawing buffer follows the capped DPR, and frame callbacks stop after teardown.
    Prompt · Step 3
    At wide and narrow widths, compare a pixel near the beam with one well outside it and check that the text zone remains dark. Use the foreground link with both mouse and keyboard. Emulate reduced motion and confirm the still frame after resize. Unmount after two resizes, then confirm the frame count has stopped.

Implementation lookup

Find the actual behavior in the recipe and check it in your browser.

Tune the documented controlsInputs
Command or reference
u_resolution · u_time · u_xOffset · u_coreWidth · u_glowWidth · u_smokeDensity
Examples
The beam core draws brighter than the distant edge without blocking foreground links.
Check the fallback and lifecycleVerify
Command or reference
Reload and recheck
Examples
The drawing buffer follows the capped DPR, and frame callbacks stop after teardown.

FAQ

How do I move the beam and change its color?

Change u_xOffset in aspect-correct, centered coordinates. Set u_color from the page accent and leave the core color independent so the halo and smoke carry the brand tint.

What does the installed demo include?

The bundled reference wrapper expects shared runtimes absent from the installed Skill. Use demo/preview.jpg and the portable shader recipe in SKILL.md.