Install
openclaw skills install fec-canvas-threejsUse when building or reviewing Canvas 2D, Three.js/WebGL, React Three Fiber, GLSL shaders, ShaderToy-to-WebGL adaptation, 2D/3D visualization, game rendering, animation loops, GPU resource cleanup, or rendering performance. Do not use for standard DOM UI, charts already covered by a chart library, or non-graphical performance work; Chinese triggers include Canvas, Three.js, WebGL, GLSL, Shader, 3D, 数据可视化, 游戏.
openclaw skills install fec-canvas-threejs在浏览器中实现高性能 2D/3D 图形渲染。
requestAnimationFrame,不可见或无变化时暂停,卸载时取消。aria-label、替代文本或 DOM 版摘要;交互式图形要有键盘兜底。const dpr = Math.min(window.devicePixelRatio || 1, 2);
canvas.width = width * dpr;
canvas.height = height * dpr;
canvas.style.width = `${width}px`;
canvas.style.height = `${height}px`;
ctx.scale(dpr, dpr);
let animationId = 0;
function animate() {
animationId = requestAnimationFrame(animate);
renderer.render(scene, camera);
}
return () => {
cancelAnimationFrame(animationId);
geometry.dispose();
material.dispose();
renderer.dispose();
};
涉及 Canvas 2D 绘图、动画循环、Three.js 场景搭建、React Three Fiber、InstancedMesh 和性能清理时,加载 references/rendering-patterns.md。
涉及着色器路由、WebGL2 适配、GLSL 调试、多 pass 预算和视觉验证时,加载 references/shader-webgl-patterns.md。
dispose() 会造成 GPU 内存泄漏。2D/3D 场景清晰、响应式、可清理,关键设备上接近 60fps;用户能通过替代文本或键盘路径理解/操作核心内容。