Skip to main content

Function: Surface3D()

Surface3D(props): ReactElement

Defined in: packages/sdvplot/src/react/three.tsx:132

sporty's playing surface in a react-three-fiber scene: surfaceMesh as one mesh in the z = 0 plane, in the surface's own units (feet for a baseball field or a rink, metres for a pitch), z up, so set the camera's up={[0, 0, 1]}. Drawn unlit in sporty's colours, before the scene's other objects and without depth writes, so its features paint over each other in order with no z-fighting. Put it inside your <Canvas>. three and @react-three/fiber (0.186.1 and 9.8.1 or later) and @sportsdataverse/sporty load when it first renders, never with sdvplot/react; a missing peer throws OptionalDependencyError then. The failed load is kept until the page reloads, so installing the peer needs a reload. A server render draws nothing.

See it drawn in the Three.js guide (sdvplot/three/statcast-pitches in the gallery).

Parameters​

props​

Surface3DProps

Returns​

ReactElement