Skip to main content
skill CX Codex

typegpu · boraoztunc — Claude Code skill: WebGPU rendering in HyperFrames

Skill for building GPU compositions with TypeGPU and WebGPU in HyperFrames: WGSL fragment shaders, compute pipelines, liquid glass effects, and particles on canvas.

Apache-2.0 207 installs ★ 484 updated 2026-08-15

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add boraoztunc/skills --skill typegpu -a claude-code
Open on GitHub

What typegpu does

The skill provides WebGPU rendering patterns for HyperFrames: full-screen triangle without a vertex buffer, rounded-rect SDF for glass pills, two-pass downsample blur, and video-as-texture workflows. The adapter sets window.__hfTypegpuTime and dispatches an hf-seek event when the timeline seeks.

The pipeline initializes asynchronously (await navigator.gpu.requestAdapter()), but GSAP tweens must register synchronously — before any await — because the HyperFrames player reads the timeline at page load. Rendering uses time from the hf-seek event, not performance.now(). For video renders, call await device.queue.onSubmittedWorkDone() after GPU submission to flush the canvas before frame capture. The adapter does not check for WebGPU availability — you guard against missing navigator.gpu yourself.

What it helps with

  • embed WGSL GPU shaders into HyperFrames timelines
  • render frosted glass blur via two-pass downsample
  • use <video> as input texture for GPU effects
  • sync GSAP tweens with async WebGPU initialization
  • capture deterministic frames for video render in headless Chrome

Example prompts for the agent

  • Build a full-screen GPU shader for HyperFrames with a rounded-rect SDF
  • Add frosted glass blur via 1/6 resolution downsample and chromatic refraction
  • Use video aroll as texture for liquid glass, sync with hf-seek

How to install typegpu

1Skills CLI (Vercel)

npx skills add boraoztunc/skills --skill typegpu -a claude-code

2Manually: put the files in place

~/.claude/skills/typegpu/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/typegpu/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about typegpu

How to install typegpu in Claude Code?

Run npx skills add boraoztunc/skills --skill typegpu -a claude-code, then ask the agent to read ~/.claude/skills/typegpu/SKILL.md.

What does the typegpu skill do?

Provides WebGPU rendering patterns for HyperFrames: full-screen shader, SDF shapes, downsample blur, video-as-texture workflows, and GSAP tween sync with async pipeline init.

Why register GSAP tweens before await?

HyperFrames reads the timeline immediately at page load. Tweens registered after await navigator.gpu.requestAdapter() will not be seen by the player.

Source text

SKILL.md · Apache-2.0
---
name: typegpu
description: TypeGPU and raw WebGPU adapter patterns for HyperFrames. Use when creating GPU-rendered compositions with TypeGPU, raw WebGPU, WGSL fragment shaders, compute pipelines, liquid glass effects, particle systems, or any canvas layer driven by navigator.gpu that responds to HyperFrames hf-seek events.
---

# TypeGPU / WebGPU for HyperFrames

HyperFrames supports TypeGPU and raw WebGPU through its `typegpu` runtime adapter. The adapter does not own your pipeline. It publishes HyperFrames time and dispatches a seek event so your composition can render the exact GPU frame.

## Contract

- Initialize WebGPU asynchronously (`await navigator.gpu.requestAdapter()`), but register all GSAP tweens **synchronously** — before any `await`. The HyperFrames player reads the timeline immediately at page load.
- Render from HyperFrames time, not `performance.now()`.
- Listen for the `hf-seek` event and re-render at exactly that time.
- Guard against environments where WebGPU is unavailable — the adapter does not check for you.
- For video renders, call `await device.queue.onSubmittedWorkDone()` after submitting GPU work to ensure the canvas is flushed before the frame is captured.

The adapter sets `window.__hfTypegpuTime` and dispatches `new CustomEvent("hf-seek", { detail: { time } })` on each seek.

## Basic Pattern

```html
<canvas id="gpu-layer"></canvas>
<script>
  (async () => {
    if (!navigator.gpu) return;
    const adapter = await navigator.gpu.requestAdapter();
    if (!adapter) return;
    const device = await adapter.requestDevice();
    const canvas = document.getElementById("gpu-layer");
    canvas.width = 1920;
    canvas.height = 1080;
    const ctx = canvas.getContext("webgpu");
    const fmt = navigator.gpu.getPreferredCanvasFormat();
    ctx.configure({ device, format: fmt, alphaMode: "opaque" });

    // Build your pipeline, buffers, bind groups...
    const timeUniform = new Float32Array([0]);
    const timeBuf = device.createBuffer({
      size: 16,
      usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
    });

    function render(t) {
      timeUniform[0] = t;
      device.queue.writeBuffer(timeBuf, 0, timeUniform);
      const enc = device.createCommandEncoder();
      const pass = enc.beginRenderPass({
        colorAttachments: [
          {
            view: ctx.getCurrentTexture().createView(),
            loadOp: "clear",
            clearValue: { r: 0, g: 0, b: 0, a: 1 },
            storeOp: "store",
          },
        ],
      });
      pass.setPipeline(pipeline);
      pass.setBindGroup(0, bindGroup);
      pass.draw(3);
      pass.end();
      device.queue.submit([enc.finish()]);
    }

    render(0);
    window.addEventListener("hf-seek", (e) => render(e.detail.time));
  })();
</script>
```

## Timeline Registration

GSAP tweens that drive text, captions, or HTML elements must be registered **synchronously** — before any `await`:

```js
const tl = gsap.timeline({ paused: true });

// Caption tweens: synchronous, added before WebGPU init
gsap.set(".cap", { opacity: 0 });
tl.to("#cap-1", { opacity: 1, duration: 0.3 }, 1.0);
tl.to("#cap-1", { opacity: 0, duration: 0.2 }, 3.5);

window.__timelines["my-comp"] = tl;

// GPU-dependent tweens can go inside the async IIFE
(async () => {
  // ... WebGPU init ...
  const proxy = { value: 0 };
  tl.to(proxy, { value: 1, duration: 2, onUpdate: render }, 0.5);
})();
```

## Video-Backed Effects (Liquid Glass, Distortion)

To use a `<video>` as the GPU input texture:

```js
const videoEl = document.getElementById("aroll");

// Wait for video metadata before creating the texture
await new Promise((r) => {
  if (videoEl.readyState >= 1) r();
  else videoEl.addEventListener("loadedmetadata", r, { once: true });
});

// Create texture at the video's NATIVE resolution
const vw = videoEl.videoWidth,
  vh = videoEl.videoHeight;
const bgTex = device.createTexture({
  size: [vw, vh],
  format: "rgba8unorm",
  usage:
    GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT,
});

function render(t) {
  try {
    device.queue.copyExternalImageToTexture({ source: videoEl }, { texture: bgTex }, [vw, vh]);
  } catch (_) {
    /* frame not decoded yet */
  }
  // ... draw ...
}
```

**Render-mode caveat:** headless Chrome may fail `copyExternalImageToTexture` for video elements. For production renders, pre-extract key frames via FFmpeg as PNGs and load them as image textures instead.

## Frosted Blur via Downsample Pass

A single-pass Gaussian kernel is too weak for glass-like frosted blur. Use a two-pass approach:

1. **Pass 1 — Downsample:** render the full-res texture to a small texture (1/6 resolution). Bilinear filtering during the downsample naturally averages pixels.
2. **Pass 2 — Glass composite:** sample the small texture for the frosted interior (bilinear upscale = heavy smooth blur) and the full-res texture for sharp areas and chromatic refraction.

This matches TypeGPU's `textureSampleBias` mip-level approach without generating mipmaps.

## Transparent vs Opaque Canvas

- **`alphaMode: 'opaque'`** — the GPU canvas renders the full frame (video + effect). Use when the GPU pipeline handles all visual content.
- **`alphaMode: 'premultiplied'`** — the GPU canvas is transparent where alpha = 0, letting HTML elements below show through. Use for overlays (particles, path animations) on top of a regular `<video>` element.

## WGSL Full-Screen Triangle

The standard vertex shader for full-screen effects (no vertex buffer needed):

```wgsl
struct Vo { @builtin(position) pos: vec4f, @location(0) uv: vec2f }

@vertex fn vs(@builtin(vertex_index) vi: u32) -> Vo {
  let ps = array<vec2f, 3>(vec2f(-1., -1.), vec2f(3., -1.), vec2f(-1., 3.));
  let ts = array<vec2f, 3>(vec2f(0., 1.), vec2f(2., 1.), vec2f(0., -1.));
  return Vo(vec4f(ps[vi], 0., 1.), ts[vi]);
}
```

Draw with `pass.draw(3)` — one triangle that covers the viewport.

## Rounded-Rect SDF (Liquid Glass Pill)

```wgsl
fn sdf_box(p: vec2f, half_size: vec2f, corner_radius: f32) -> f32 {
  let d = abs(p) - half_size + vec2f(corner_radius);
  return length(max(d, vec2f(0.))) + min(max(d.x, d.y), 0.) - corner_radius;
}
```

Use this to define inside/ring/outside zones for glass effects. Negative values are inside the shape.

## Deterministic Rendering

- No `Math.random()` — use a seeded PRNG.
- No `requestAnimationFrame` for the render loop — render only in response to `hf-seek`.
- No `performance.now()` for animation time — read `window.__hfTypegpuTime` or `e.detail.time`.
- After GPU submit, call `await device.queue.onSubmittedWorkDone()` for render-mode frame capture.

© boraoztunc · Apache-2.0 · boraoztunc/skills

Similar skills

All skills for Frontend and UI →

typegpu by other authors comes first.

typegpu software-mansion-labs Helps the agent write TypeGPU code: shaders, buffers, pipelines and the @typegpu/react hooks, with the type plumbing handled. CX Codex +1 2,000installs webgpu cazala This skill guides WebGPU and WGSL work, from pipeline design to debugging and tuning. Use it for rendering, compute workloads, and GPU simulations. CX Codex +1 886installs pixijs-custom-rendering pixijs pixijs-custom-rendering is a Claude Code skill for low-level rendering in PixiJS v8, including shaders, filters, batchers, and draw code. It activates for requests about GLSL, WGSL, uniforms, or textures. CX Codex +1 7,000installs webgpu-threejs-tsl dgreenheck webgpu-threejs-tsl guides an agent through Three.js work with WebGPU, TSL node materials, GPU compute shaders, and post-processing effects. CX Codex +1 1,800installs webgpu-claude-skill podo Gives the agent working knowledge of Three.js on WebGPU: TSL node materials, compute shaders, post-processing, WGSL. Useful when a scene needs GPU compute. CX Codex +1 202installs web-shader-extractor lixiaolin94 web-shader-extractor investigates WebGL, WebGPU, Canvas, and shader-like effects from a webpage, then replays them locally. Useful for animated backgrounds and interactive 3D scenes. CX Codex +1 850installs pixijs-filters pixijs pixijs-filters — a skill for Claude Code, Codex, Cursor and other agents that covers the PixiJS v8 filter pipeline: built-in filters and custom GLSL/WGSL shaders via Filter.from(). CX Codex +1 7,000installs

From the same set22

The whole set →
lottie Teaches the agent to embed Lottie and dotLottie animations in HyperFrames so the composition timeline can be seeked to any frame. CX Codex +1 212installs waapi waapi instructs agents to write deterministic Web Animations API code for HyperFrames without relying on heavy external animation engines. CX Codex +1 211installs contribute-catalog The contribute-catalog skill guides a new HyperFrames block or component from an idea to an upstream catalog PR. Use it for captions, VFX, transitions, and lower thirds. CX Codex +1 211installs three Keeps a Three.js scene in HyperFrames tied to composition time: the adapter fires hf-seek and the scene draws the frame requested. CX Codex +1 209installs linear-local-first-architecture linear-local-first-architecture tells the agent how to build a web app that answers instantly: workspace in IndexedDB, edits applied locally, sync queued in the background. CX Codex +1 201installs conductor-rewrite-performance conductor-rewrite-performance optimizes React performance in local-first Tauri desktop apps. Stops cascading re-renders on route changes and cleans up sluggish streaming lists. CX Codex +1 186installs minimal-zine-poster minimal-zine-poster turns a theme, phrase, object, or photo into a prompt for a sparse zine-style poster, then generates the image. Use it for essay or newsletter cover art. CX Codex +1 126installs tailwind-v4 tailwind-v4 — a skill for Claude Code and other AI platforms that automates Tailwind CSS v4 migration, configuration, and debugging. Runs during styling tasks or framework upgrades. CX Codex +1 125installs

Project sponsors

Companies that keep this analytics open