Skip to content

Hook to load Spline scenes into react-three-fiber

License

Notifications You must be signed in to change notification settings

MitchellRyrie-evanBuck/r3f-spline

 
 

Repository files navigation

r3f-spline

r3f-spline is a React hook that lets you use your Spline scene with react-three-fiber.

🌈 Spline is a friendly 3d collaborative design tool for the web.

WebsiteTwitterCommunityDocumentation

Install

yarn add @splinetool/r3f-spline @splinetool/loader

or

npm install @splinetool/r3f-spline @splinetool/loader

NOTE: make sure you also install the @react-three/fiber and three dependencies.

Usage

import useSpline from '@splinetool/r3f-spline'

export default function Scene({ ...props }) {
  const { nodes, materials } = useSpline('https://prod.spline.design/2fzdsSVagfszNxsd/scene.spline')

  return (
    <group {...props} dispose={null}>
      <mesh
        name="Rectangle"
        geometry={nodes.Rectangle.geometry}
        material={materials['Rectangle Material']}
      />
    </group>
  )
}

Examples

About

Hook to load Spline scenes into react-three-fiber

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 87.8%
  • HTML 6.7%
  • CSS 5.5%