example-threejs
Skill130 starsChanged 38 days agoApache-2.0View on GitHub
Patterns for using Helios with Three.js and React Three Fiber. Use when creating 3D animations or integrating WebGL scenes.
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
- skill-creatorSkill
- helios-coreSkill
- animated-video-philosophySkill
- cinematic-product-promo-planSkill
- motion-stylesSkill
- example-canvasSkill
- example-chartjsSkill
- example-d3-animationSkill
- example-framer-motionSkill
- example-gsapSkill
- example-lottieSkill
- example-p5-animationSkill
- example-pixiSkill
- example-podcast-visualizerSkill
- example-reactSkill
- example-signals-animationSkill
- example-solidSkill
- example-svelteSkill
- example-tailwind-animationSkill
- example-vanillaSkill
- example-vueSkill
- helios-getting-startedSkill
- guided-brand-videoSkill
- guided-cartoon-shortSkill
- motion-design-rulesSkill
- guided-music-videoSkill
- guided-video-recipesSkill
- helios-playerSkill
- helios-rendererSkill
- helios-skillsSkill
- helios-studioSkill
- archive-brollSkill
- create-compositionSkill
- render-videoSkill
- workflow-visualize-dataSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 66
Use useFrame as usual, but it will only fire when advance() is called.
- Very specific: line 130
Shadows: If using shadows, ensure they update correctly.
- Very specific: line 131
GLTF Loading: Use waitUntilStable or ensure assets are loaded before rendering starts.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Three.js Composition Patterns
Integrate Helios with Three.js to drive 3D animations frame-by-frame. This ensures deterministic rendering and perfect synchronization.
Quick Start (React Three Fiber)
The key is to disable the R3F internal loop (frameloop="never") and drive the scene update manually via the advance() method in a Helios subscription.
1. Setup Component
import React, { useState, useEffect } from 'react';
import { Canvas } from '@react-three/fiber';
import { Helios } from '@helios-project/core';
// Singleton Helios instance
const helios = new Helios({
fps: 30,
duration: 10,
width: 1920,
height: 1080
});
if (typeof window !== 'undefined') {
window.helios = helios; // Expose for Player/Renderer
}
export default function App() {
const [r3fState, setR3fState] = useState(null);
useEffect(() => {
if (!r3fState) return;
// Subscribe to Helios ticks
const unsubscribe = helios.subscribe((state) => {
// Calculate time in seconds
const timeInSeconds = state.currentFrame / state.fps;
// Manually advance R3F state
// This updates the clock and renders the scene
r3fState.advance(timeInSeconds);
});
return unsubscribe;
}, [r3fState]);
return (
<Canvas
frameloop="never" // Disable automatic loop
onCreated={(state) => setR3fState(state)} // Capture R3F state
gl={{ antialias: true }}
>
<Scene />
</Canvas>
);
}2. Scene Component
Use useFrame as usual, but it will only fire when advance() is called.
import { useRef } from 'react';
import { useFrame } from '@react-three/fiber';
function Scene() {
const meshRef = useRef();
useFrame((state, delta) => {
// state.clock.elapsedTime is now synced with Helios
const time = state.clock.elapsedTime;
if (meshRef.current) {
meshRef.current.rotation.x = time;
meshRef.current.rotation.y = time * 0.5;
}
});
return (
<mesh ref={meshRef}>
<boxGeometry />
<meshStandardMaterial color="orange" />
</mesh>
);
}Quick Start (Vanilla Three.js)
For vanilla Three.js, you simply call renderer.render() inside the Helios subscription.
import * as THREE from 'three';
import { Helios } from '@helios-project/core';
// Setup Helios
const helios = new Helios({ duration: 5, fps: 30 });
window.helios = helios;
// Setup Three.js
const canvas = document.getElementById('canvas');
const renderer = new THREE.WebGLRenderer({ canvas });
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, 1920 / 1080, 0.1, 1000);
const cube = new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshBasicMaterial({ color: 0x00ff00 }));
scene.add(cube);
// Animation Loop
helios.subscribe((state) => {
const time = state.currentFrame / state.fps;
// Update logic
cube.rotation.x = time;
cube.rotation.y = time;
// Render
renderer.render(scene, camera);
});Optimization Tips
- Antialiasing: Enable it in
WebGLRendereror<Canvas>for better quality, but be aware of performance cost. - Shadows: If using shadows, ensure they update correctly. In
frameloop="never", you might need to mark shadows as needing update if they are static. - GLTF Loading: Use
waitUntilStableor ensure assets are loaded before rendering starts. Helios waits forwindow.loadby default in 'dom' mode, but 'canvas' mode relies on the canvas being ready.
Source Files
- Example:
examples/react-three-fiber/ - Example:
examples/threejs-canvas-animation/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

