react-three-fiber react-three-fiber react-three-fiber

Minimal cube example

A very minimal cube example. Fork on Codesandbox

Live example


Coming Soon

Code

import React from "react";
import { render } from "react-dom";
import { Canvas } from "react-three-fiber";
import "./styles.css";

const Box = () => {
  return (
    <mesh rotation-x={Math.PI * 0.25} rotation-y={Math.PI * 0.25}>
      <boxBufferGeometry args={[2, 2, 2]} />
      <meshStandardMaterial color={"red"} />
    </mesh>
  );
};

const App = () => {
  return (
    <Canvas style=>
      <pointLight position={[5, 5, 5]} />
      <Box />
    </Canvas>
  );
};

render(<App />, document.getElementById("root"));

Running this example

Clone this repo, and then NPM install and NPM start from the relevant directory.

$ cd examples/geometry/minimal-cube-example
$ npm install && npm run start