react-three-editor
TypeScript icon, indicating that this package has built-in type declarations

2.2.1 • Public • Published

React Three Editor

Visual editor for creating animations with React Three Fiber.

Usage

import React from "react";
import ReactDOM from "react-dom";

import { Editor, useFrame } from "react-three-editor";

const Box = () => {
  const ref = React.useRef(null);

  useFrame(({ time }) => {
    const mesh = ref.current;
    if (!mesh) return;

    const t = Math.PI * (time / 1000);
    mesh.position.set(0, Math.sin(t), 0);
  });

  return (
    <>
      <pointLight position={[0, 3, 3]} />
      <ambientLight intensity={0.04} />
      <mesh ref={ref}>
        <sphereGeometry />
        <meshStandardMaterial />
      </mesh>
    </>
  );
};

ReactDOM.render(
  <React.StrictMode>
    <Editor>
      <Box />
    </Editor>
  </React.StrictMode>,
  document.getElementById("root")
);

Package Sidebar

Install

npm i react-three-editor

Weekly Downloads

2

Version

2.2.1

License

MIT

Unpacked Size

60.7 kB

Total Files

49

Last publish

Collaborators

  • paulkre