- Home
- Skills
- Frontend & Web Apps
- Canvas Webgl Renderer Helper
Works with the AI Agents you already use
Canvas Webgl Renderer Helper
Optimized 60fps HTML5 Canvas and Three.js rendering pipelines with automatic retina scaling and memory cleanup.
$15
Canvas Webgl Renderer Helper
Example session with this skill installed
Create a performant Three.js render loop for a basic scene with a rotating cube, including proper retina scaling and memory cleanup.
- Read your context and instructions
- Compiled the canvas webgl renderer
I have generated a performant Three.js boilerplate. This setup includes a responsive WebGLRenderer, a perspective camera, a basic mesh, and a delta-time animation loop. It also implements a `cleanup` function to dispose of geometries and materials, preventing memory leaks. ## Three.js Render Pipeline ```typescript import * as THREE from 'three'; export class SceneManager { private renderer: THREE.WebGLRenderer; private scene: THREE.Scene; private camera: THREE.PerspectiveCamera; private cube: THREE.Mesh; private frameId: number | null = null; private previousTime: number = 0; constructor(canvas: HTMLCanvasElement) { this.scene = new THREE.Scene(); this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); this.camera.position.z = 5; this.renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true }); this.handleResize(); const geometry = new THREE.BoxGeometry(1, 1, 1); const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 }); this.cube = new THREE.Mesh(geometry, material); this.scene.add(this.cube); window.addEventListener('resize', () => this.handleResize()); } private handleResize() { const pixelRatio = Math.min(window.devicePixelRatio, 2); this.renderer.setPixelRatio(pixelRatio); this.renderer.setSize(window.innerWidth, window.innerHeight, false); this.camera.aspect = window.innerWidth / window.innerHeight; this.camera.updateProjectionMatrix(); } public start() { const loop = (time: number) => { const deltaTime = (time - this.previousTime) / 1000; this.previousTime = time; this.cube.rotation.x += 1 * deltaTime; this.cube.rotation.y += 1 * deltaTime; this.renderer.render(this.scene, this.camera); this.frameId = requestAnimationFrame(loop); }; this.frameId = requestAnimationFrame(loop); } public cleanup() { if (this.frameId) cancelAnimationFrame(this.frameId); window.removeEventListener('resize', () => this.handleResize()); this.cube.geometry.dispose(); (this.cube.material as THREE.Material).dispose(); this.renderer.dispose(); } } ``` **Next steps** - Mount the `SceneManager` within your component's lifecycle (e.g., `useEffect` in React). - Swap the `MeshBasicMaterial` for a `ShaderMaterial` to implement custom GLSL effects. - Add lighting and shadows by initializing `THREE.DirectionalLight` and enabling `shadowMap`.
Connects securely to your tools. The creator never sees your data.
About this skill
Building high-performance graphics on the web often leads to blurry scaling, memory leaks, and janky frame rates. This skill provides optimized TypeScript rendering pipelines for HTML5 Canvas and Three.js to ensure smooth 60fps execution. ## What it does - **Scene Initialization** sets up Canvas 2D contexts or Three.js WebGLRenderer components with proper camera and scene nesting. - **Retina Scaling** automatically handles `window.devicePixelRatio` to ensure crisp visuals on high-density displays. - **Delta-Time Loops** implements `requestAnimationFrame` cycles with time-based calculations for frame-rate-independent animations. - **Memory Management** generates disposal logic for geometries and materials to prevent memory leaks during component unmounts. ## How it works 1. **Initialize** the rendering environment and context based on the requested engine (2D or WebGL). 2. **Scale** the viewport dimensions and pixel ratio for the target hardware. 3. **Loop** animation logic using delta-time to ensure consistent physics across different refresh rates. 4. **Dispose** of GPU resources and event listeners to keep the application stable. ## Frameworks & tools This skill focuses on TypeScript and JavaScript environments using the HTML5 Canvas API or Three.js. It integrates into modern frontend stacks like React, Next.js, and Vite. ## Why this beats prompting it yourself Generic prompts often ignore the boilerplate needed for DPI scaling and GPU memory cleanup. This skill enforces strict disposal patterns and frame-rate independence, saving you from manual debugging of performance degradation and memory bloat. ## Use cases - Build interactive particle systems with high-performance 2D Canvas. - Create 3D data visualizations or product viewers using Three.js and WebGL. - Implement responsive creative coding sketches that adapt to window resizing. - Develop custom shader materials with optimized render pipelines. ## Known limitations This skill focuses on rendering pipelines and boilerplate. It does not provide complex 3D modeling, asset creation, or physics engine integration like Cannon.js or Ammo.js.
Focuses on boilerplate and rendering logic. Does not include 3D modeling, asset creation, or external physics engine integration. Requires an existing TypeScript or JavaScript project environment.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 3 days ago
Requires
Permissions
Target Use Cases: - Create an HTML5 Canvas animation loop with Retina support. - Build a Three.js scene with proper memory disposal. - Implement an interactive particle system on WebGL canvas.