react-three-fiber react-three-fiber

Background color

Using a color element to attach a background color to a scene. Fork on Codesandbox

Live example



Code

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

const App = () => {
  return (
    <Canvas style=>
      <color attach="background" args={"black"} />
    </Canvas>
  );
};

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

Running this example

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

$ cd examples/basic/background-color
$ npm install && npm run start