Record react-three-fiber scenes with ccapture.js
- Not yet ready for general use, if you try it let me know ✌️
- Gif format doesn't work yet
Check a simple example on codesandbox
import useCapture from "use-capture";
function App() {
const [bind, startRecording] = useCapture({ duration: 2, fps: 60 });
return (
<>
<Canvas
// 💡 preserveDrawingBuffer is mandatory
gl={{
preserveDrawingBuffer: true,
}}
onCreated={bind}
>
{/* 💡 not having a clear color would glitch the recording */}
<color attach="background" args={["#000"]} />
<Scene duration={duration} />
</Canvas>
);
}
<button onClick={startRecording}> ⏺️ Start Recording </button>
Your file will start downloading as soon as it's done.