-
Notifications
You must be signed in to change notification settings - Fork 155
Entry Point
Wiki ▸ React3
import React3 from 'react-three-renderer';
React3 is a regular React Component that places a canvas on the page.
When React3 is mounted, an instance of React3Renderer is used to render a <react3> internal component into the canvas.
The react3 internal component repeatedly requests animation frames from the browser.
Every frame it re-renders the whole scene.
The attributes are passed on to the react3 internal component so that it can configure the renderer.
one of [2d, 3d]
required
: The rendering context.
Currently only '3d' is supported.
number
required
: The height of the canvas and the default viewport.
number
required
: The width of the canvas and the default viewport.
bool
: Controls renderer gamma input.
See THREE.WebGLRenderer#gammaInput.
bool
: Controls renderer gamma output.
See THREE.WebGLRenderer#gammaOutput.
bool
: Controls renderer object sorting.
See THREE.WebGLRenderer#sortObjects.
string
: The name of the camera to render into the canvas.
If this value is not set, the scene can be rendered into the <viewport/> children of React3.
function
: This callback gets called before every frame.
one of types [THREE.Color, number, string]
: The clear color of the renderer.
Is used as the first parameter for THREE.WebGLRenderer#clearColor.
If the clearAlpha
and alpha
properties are set, clearAlpha
will be used as the second parameter.
number
: Used for the transparency of the canvas.
Expected range: 0 to 1, where 0 is clear and 1 is opaque.
Is used as the second parameter for THREE.WebGLRenderer#clearColor.
If the clearColor
property is set, that will be passed as the first parameter.
Requires the alpha
property to be set.
bool
: Toggles shadowMap usage.
See THREE.WebGLRenderer#shadowMapEnabled.
WARNING: Updating this value will force all materials to refresh.
one of [THREE.BasicShadowMap, THREE.PCFShadowMap, THREE.PCFSoftShadowMap]
: Controls the shadowMap type.
See THREE.WebGLRenderer#shadowMapType.
WARNING: Updating this value will force all materials to refresh.
one of [THREE.CullFaceNone, THREE.CullFaceBack, THREE.CullFaceFront, THREE.CullFaceFrontBack]
: Controls shadowMap face culling.
See THREE.WebGLRenderer#shadowMapCullFace.
WARNING: Updating this value will force all materials to refresh.
bool
: Toggles shadowMap debugging.
See THREE.WebGLRenderer#shadowMapDebug.
WARNING: Updating this value will force all materials to refresh.
number
: The pixel ratio of the renderer.
Preferred value: window.devicePixelRatio.
one of [highp, mediump, lowp]
: Sets the precision of the renderer.
See THREE.WebGLRenderer#precision.
WARNING: This recreates the whole canvas.
bool
: Toggles alpha setting of the renderer.
See THREE.WebGLRenderer#alpha.
WARNING: This recreates the whole canvas.
bool
: Toggles the premultipliedAlpha setting of the renderer.
See THREE.WebGLRenderer#premultipliedAlpha.
WARNING: This recreates the whole canvas.
one of types [bool, number]
: Toggles anti-aliasing of the renderer.
See THREE.WebGLRenderer#antialias.
WARNING: This recreates the whole canvas.
bool
: Toggles the stencil property of the renderer.
See THREE.WebGLRenderer#stencil.
WARNING: This recreates the whole canvas.
bool
: Toggles the preserveDrawingBuffer property of the renderer.
See THREE.WebGLRenderer#preserveDrawingBuffer.
WARNING: This recreates the whole canvas.
bool
: Toggles the depth property of the renderer.
See THREE.WebGLRenderer#depth.
WARNING: This recreates the whole canvas.
bool
: Toggles the logarithmicDepthBuffer property of the renderer.
See THREE.WebGLRenderer#logarithmicDepthBuffer.
WARNING: This recreates the whole canvas.
any
The style properties to be passed onto the canvas.
Similar to ReactDOM.findDOMNode.
Finds a THREE.js object from a mounted component.
You are encouraged to use refs instead.
Advanced usage. Used to dispatch events. Undocumented for now.
===
View Source |
---|
Home | Usage | API Reference | Examples