Skip to content

fritx/react-threejs

Repository files navigation

react-threejs

WIP: Simplest bindings between React & Three.js

http://fritx.github.io/react-threejs/example/

See also: vue-threejs

import React, { Component } from 'react'
import { Renderer, Camera, Scene } from 'react-threejs'
render () {
  return (<Renderer size={rendererSize}>
    <Camera position={{ z: 5 }} />
    <Scene>
      <MyCube color={0x00ff00} rotation={rotation}>
        <MyCube color={0xff0000} position={{ y: 2 }} />
        <MyCube color={0x0000ff} position={{ z: 3 }} />
      </MyCube>
    </Scene>
  </Renderer>)
}
// setting FirstPersonControls, PositionalAudio & more
render () {
  return (<Renderer size={rendererSize}>
    <Scene>
      <FirstPersonControls>
        <AudioListener />
        <Camera />
      </FirstPersonControls>
      <Mesh rotation={rotation} geometry={geometry} material={material}>
        <PositionalAudio url="Project_Utopia.ogg" />
      </Mesh>
    </Scene>
  </Renderer>)
}

About

WIP: Simplest bindings between React & Three.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published