Skip to content

BjornMelin/dev-skills / plugins/web-motion/skills/web-three-r3f

web-three-r3f

Verified

Use this skill for Three.js, React Three Fiber, Drei, Canvas/createRoot lifecycle, loaders, GLTF, useFrame, disposal, SSR/client boundaries, DPR, and browser proof. Trigger on Three.js, THREE, @react-three/fiber, @react-three/drei, R3F Canvas, useFrame, GLTF, WebGLRenderer. Do not use for near-miss tasks outside these boundaries; route to adjacent motion or platform skills when they own the implementation.

references/docs-r3f-canvas.md

View on GitHub
# R3F Canvas Source Notes

Source: https://r3f.docs.pmnd.rs/api/canvas

Checked: 2026-06-04.

Use this file when a task depends on Canvas defaults, fallback behavior, custom
renderer creation, or root ownership.

## API Boundaries

- `<Canvas>` is the normal React portal into Three.js. It creates renderer,
  scene, camera, raycaster, events, and resize measurement for the React tree.
- Important props to decide intentionally: `fallback`, `gl`, `camera`, `scene`,
  `shadows`, `raycaster`, `frameloop`, `resize`, `orthographic`, `dpr`,
  `events`, `eventSource`, `eventPrefix`, and `onCreated`.
- Default DPR is automatic `[1, 2]`; heavy scenes often need a lower clamp or
  adaptive policy.
- `frameloop` supports `always`, `demand`, and `never`. Use `demand` for idle
  scenes, and call `invalidate()` when imperative code mutates visible state.
- `<Canvas fallback={...}>` handles unsupported WebGL. Use an error boundary
  for context creation failures, GPU-disabled browsers, and asset failures.

## Renderer Lifecycle

- `<Canvas>` owns the default WebGL renderer lifecycle. Avoid duplicating that
  lifecycle in nested effects unless the app has a deliberate custom renderer.
- Custom `gl` callbacks may create WebGL or WebGPU renderers. If the callback
  returns app-created objects, confirm the installed R3F version's cleanup
  behavior and define ownership for resources not managed by R3F.
- Custom `createRoot(canvas)` is lower-level than `<Canvas>`: the caller must
  configure, size, render, and unmount the root. Do not assume automatic resize.

## Framing Checks

- Confirm the canvas parent has a stable nonzero size before debugging scene
  code.
- Confirm camera fov/near/far/position, object scale, and model origin place
  the subject inside the frustum.
- Screenshot and canvas-pixel checks should prove both nonblank rendering and
  useful framing, not just that WebGL initialized.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall