{"bugs":{"url":"https://github.com/drcmda/react-three-fiber/issues"},"dist":{"shasum":"1122717c35f06938af677f4afaf26aea66f0aa82","tarball":"https://registry.npmjs.org/react-three-fiber/-/react-three-fiber-6.0.0-alpha.3.tgz","fileCount":24,"integrity":"sha512-rFpGfJ88gkNsQGuYULZRjWuczsD8kiZylBNMR6U9cVOkJ2eKoXY/LBN8ofcXxy6N0pM0Ek6pta1+rh79NqIMIg==","signatures":[{"sig":"MEYCIQCooRiClKfPPB/gYQjlifDMwrIOWAhEins2b8XEy3ZogAIhAPu3JNAC/TqYm25eR23IUjNmBqlSWIO2B08TYpqpBTLN","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":155936,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQ28aCRA9TVsSAnZWagAAvCkP+wf+eXbztBYICvBiTDXH\nSr9k2e6bjpbUd4N31jQyioHIEZkzvXX0yWj9YXaLPNXmfA5PM2dAl2IHRVjI\nQoOp2pqG860kJ2p24HSPNI630hieksiIAaIkXagvUc/3csAfucd76YNGzvDu\n98dD1XEK5l/9KQw0MhVJvj93xjGVdqeP0cVLRrRoR2/8anlZXsvE+bvTh7D1\nelDQJmez5i1L2BmuPl8+s1/Jfsybt0cGdkIZJUYJCZWpqBXhnm61KIaenE7V\n6gvdUZDLCbvytl/yPodKjsZZAyxof8qr8t1eoqghrAu5tdFeqaDf9E0XpSiD\nNY6H1U3GFh370dMbTeBY4RmcBE3ixonhcgPvgUCgpZLqU/W0ZdCbmpDA3uky\nB8oeiNgetmx6GZbuAFkMY3+6xLRN/mnvu66uRfi0rcaheWIDPn453xJ2ghFY\n7INC50J1tvFl3dIozkBeG5J7DbUqevHzs7Z6rIaLXXjNdrleCdN8RDN9eXUJ\nK3RL1swFUwrRAsL/H5Cfd+YCm5OARyDsRLd8vS/NiHbX3jKNZo+OTyRjVRhc\nahhpiyTCZNbNSgiqptr/ya5dZXW6xzEtvPwNE9NQZuS5c8rqevPB8JTFJe+Y\npEnaLxvF+uXHezV1s2cWcyTTkY0SdZ/SHGFG5qIdXEWOTKP5m1e4czwXMvOS\nWg8W\r\n=9+xN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.cjs.js","name":"react-three-fiber","husky":{"hooks":{"pre-commit":"lint-staged"}},"types":"dist/web/index.d.ts","author":{"name":"Paul Henschel"},"module":"dist/index.js","readme":"<h1>react-three-fiber</h1>\n\n[![Version](https://img.shields.io/npm/v/react-three-fiber?style=flat&colorA=000000&colorB=000000)](https://npmjs.com/package/react-three-fiber)\n[![Downloads](https://img.shields.io/npm/dt/react-three-fiber.svg?style=flat&colorA=000000&colorB=000000)](https://npmjs.com/package/react-three-fiber)\n[![Twitter](https://img.shields.io/twitter/follow/pmndrs?label=%40pmndrs&style=flat&colorA=000000&colorB=000000&logo=twitter&logoColor=000000)](https://twitter.com/pmndrs)\n[![Discord](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=000000)](https://discord.gg/ZZjjNvJ)\n[![Open Collective](https://img.shields.io/opencollective/all/react-three-fiber?style=flat&colorA=000000&colorB=000000)](https://opencollective.com/react-three-fiber)\n[![ETH](https://img.shields.io/badge/ETH-f5f5f5?style=flat&colorA=000000&colorB=000000)](https://blockchain.com/eth/address/0x6E3f79Ea1d0dcedeb33D3fC6c34d2B1f156F2682)\n[![BTC](https://img.shields.io/badge/BTC-f5f5f5?style=flat&colorA=000000&colorB=000000)](https://blockchain.com/btc/address/36fuguTPxGCNnYZSRdgdh6Ea94brCAjMbH)\n\nreact-three-fiber is a React <a href=\"https://reactjs.org/docs/codebase-overview.html#renderers\">renderer</a> for threejs on the web and react-native.\n\n```bash\nnpm install three react-three-fiber\n```\n\n<p align=\"center\">\n  <a href=\"https://codesandbox.io/embed/r3f-game-i2160\"><img width=\"274\" src=\"https://i.imgur.com/VydCh6W.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-gamma-correction-kmb9i\"><img width=\"274\" src=\"https://i.imgur.com/e6NhRz6.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-montage-jz9l97qn89\"><img width=\"274\" src=\"https://i.imgur.com/nxRStP8.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-sparks-sbf2i\"><img width=\"274\" src=\"https://i.imgur.com/Fk44Tu6.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-instanced-colors-8fo01\"><img width=\"274\" src=\"https://i.imgur.com/daJIDVE.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-moksha-f1ixt\"><img width=\"274\" src=\"https://i.imgur.com/ltznOJ1.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-bones-3i7iu\"><img width=\"274\" src=\"https://i.imgur.com/OZdSyQy.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-floating-diamonds-prb9t\"><img width=\"274\" src=\"https://i.imgur.com/WWDbcWG.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-volumetric-light-w633u\"><img width=\"274\" src=\"https://i.imgur.com/7E3XKSG.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-particles-ii-pjcc1\"><img width=\"274\" src=\"https://i.imgur.com/QG14IAC.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-gltf-fonts-c671i\"><img width=\"274\" src=\"https://i.imgur.com/SHPhIls.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-cannon-physics-nr84m\"><img width=\"274\" src=\"https://i.imgur.com/M9rupWP.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/wonderful-chandrasekhar-8l9rrj36j0\"><img width=\"274\" src=\"https://i.imgur.com/HSTGdcO.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-train-l900i\"><img width=\"274\" src=\"https://i.imgur.com/B3AzZVH.gif\" /></a>\n  <a href=\"https://codesandbox.io/embed/r3f-particles-i-q4d2v\"><img width=\"274\" src=\"https://i.imgur.com/XscsWgu.gif\" /></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, you can click them! They contain the full code, too.</i>\n</p>\n\n#### Why?\n\nBuilding dynamic scene graphs declaratively with re-usable components makes dealing with threejs easier and brings order and sanity to your codebase. These components react to state changes, are interactive out of the box and can tap into React's infinite ecosystem.\n\n#### Does it have limitations?\n\nNone. Everything that works in threejs will work here. In contrast to \"bindings\" where a library ships/maintains dozens of wrapper components, it just renders JSX to threejs dynamically: `<mesh />` simply is another expression for `new THREE.Mesh()`. It does not know or target a specific threejs version nor does it need updates for modified, added or removed upstream features.\n\n#### Is it slower than raw threejs?\n\nNo. Rendering performance is up to threejs and the GPU. Components participate in the renderloop outside of React, without any additional overhead. React is otherwise very efficient in building and managing component-trees, it could potentially outperform manual/imperative apps at scale.\n\n#### What does it look like?\n\n<table>\n  <tr>\n    <td>Let's make a re-usable component that has its own state, reacts to user-input and participates in the render-loop. (<a href=\"https://codesandbox.io/s/rrppl0y8l4?file=/src/App.js\">live demo</a>).</td>\n    <td>\n      <a href=\"https://codesandbox.io/s/rrppl0y8l4\">\n        <img src=\"https://i.imgur.com/sS4ArrZ.gif\" /></td>\n      </a>\n  </tr>\n</table>\n\n```jsx\nimport ReactDOM from 'react-dom'\nimport React, { useRef, useState } from 'react'\nimport { Canvas, useFrame } from 'react-three-fiber'\n\nfunction Box(props) {\n  // This reference will give us direct access to the mesh\n  const mesh = useRef()\n\n  // Set up state for the hovered and active state\n  const [hovered, setHover] = useState(false)\n  const [active, setActive] = useState(false)\n\n  // Rotate mesh every frame, this is outside of React without overhead\n  useFrame(() => {\n    mesh.current.rotation.x = mesh.current.rotation.y += 0.01\n  })\n\n  return (\n    <mesh\n      {...props}\n      ref={mesh}\n      scale={active ? [1.5, 1.5, 1.5] : [1, 1, 1]}\n      onClick={(event) => setActive(!active)}\n      onPointerOver={(event) => setHover(true)}\n      onPointerOut={(event) => setHover(false)}>\n      <boxBufferGeometry args={[1, 1, 1]} />\n      <meshStandardMaterial color={hovered ? 'hotpink' : 'orange'} />\n    </mesh>\n  )\n}\n\nReactDOM.render(\n  <Canvas>\n    <ambientLight />\n    <pointLight position={[10, 10, 10]} />\n    <Box position={[-1.2, 0, 0]} />\n    <Box position={[1.2, 0, 0]} />\n  </Canvas>,\n  document.getElementById('root')\n)\n```\n\n<details>\n  <summary>Show TypeScript example</summary>\n\n```tsx\nimport ReactDOM from 'react-dom'\nimport React, { useRef, useState } from 'react'\nimport { Canvas, MeshProps, useFrame } from 'react-three-fiber'\nimport type { Mesh } from 'three'\n\nconst Box: React.FC<MeshProps> = (props) => {\n  // This reference will give us direct access to the mesh\n  const mesh = useRef<Mesh>()\n\n  // Set up state for the hovered and active state\n  const [hovered, setHover] = useState(false)\n  const [active, setActive] = useState(false)\n\n  // Rotate mesh every frame, this is outside of React without overhead\n  useFrame(() => {\n    if (mesh.current) mesh.current.rotation.x = mesh.current.rotation.y += 0.01\n  })\n\n  return (\n    <mesh\n      {...props}\n      ref={mesh}\n      scale={active ? [1.5, 1.5, 1.5] : [1, 1, 1]}\n      onClick={(event) => setActive(!active)}\n      onPointerOver={(event) => setHover(true)}\n      onPointerOut={(event) => setHover(false)}>\n      <boxBufferGeometry args={[1, 1, 1]} />\n      <meshStandardMaterial color={hovered ? 'hotpink' : 'orange'} />\n    </mesh>\n  )\n}\n\nReactDOM.render(\n  <Canvas>\n    <ambientLight />\n    <pointLight position={[10, 10, 10]} />\n    <Box position={[-1.2, 0, 0]} />\n    <Box position={[1.2, 0, 0]} />\n  </Canvas>,\n  document.getElementById('root')\n)\n```\n\n</details>\n\n---\n\n# API\n\n- [api.md](/markdown/api.md)\n- [pitfalls.md](/markdown/pitfalls.md)\n- [recipes.md](/markdown/recipes.md)\n\n# Fundamentals\n\nYou need to be versed in both React and Threejs before rushing into this. If you are unsure about React consult the official [React docs](https://reactjs.org/docs/getting-started.html), especially [the section about hooks](https://reactjs.org/docs/hooks-reference.html). As for Threejs, make sure you at least glance over the following links:\n\n1. Make sure you have a [basic grasp of Threejs](https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene). Keep that site open.\n2. When you know what a scene is, a camera, mesh, geometry, material, fork the [demo above](https://github.com/react-spring/react-three-fiber#what-does-it-look-like).\n3. [Look up](https://threejs.org/docs/index.html#api/en/objects/Mesh) the JSX elements that you see (mesh, ambientLight, etc), _all_ threejs exports are native to three-fiber.\n4. Try changing some values, scroll though our [Api](/markdown/api.md) to see what the various settings and hooks do.\n\nSome reading material:\n\n- [Threejs-docs](https://threejs.org/docs)\n- [Threejs-examples](https://threejs.org/examples)\n- [Threejs-fundamentals](https://threejsfundamentals.org)\n- [Discover Threejs](https://discoverthreejs.com)\n- [Do's and don'ts](https://discoverthreejs.com/tips-and-tricks) for performance and best practices\n- [react-three-fiber alligator.io tutorial](https://alligator.io/react/react-with-threejs) by [@dghez\\_](https://twitter.com/dghez_)\n\n# Ecosystem\n\n- [`@react-three/gltfjsx`](https://github.com/react-spring/gltfjsx) &ndash; turns GLTFs into JSX components\n- [`@react-three/drei`](https://github.com/react-spring/drei) &ndash; useful helpers for react-three-fiber\n- [`@react-three/postprocessing`](https://github.com/react-spring/react-postprocessing) &ndash; post-processing effects\n- [`@react-three/flex`](https://github.com/react-spring/react-three-flex) &ndash; flexbox for react-three-fiber\n- [`@react-three/xr`](https://github.com/react-spring/react-xr) &ndash; VR/AR controllers and events\n- [`@react-three/cannon`](https://github.com/react-spring/use-cannon) &ndash; physics based hooks\n- [`zustand`](https://github.com/react-spring/zustand) &ndash; state management\n- [`react-spring`](https://github.com/react-spring/react-spring) &ndash; a spring-physics-based animation library\n- [`react-use-gesture`](https://github.com/react-spring/react-use-gesture) &ndash; mouse/touch gestures\n- [`react-three-gui`](https://github.com/ueno-llc/react-three-gui) &ndash; GUI/debug tools\n\n# How to contribute\n\nIf you like this project, please consider helping out. All contributions are welcome as well as donations to [Opencollective](https://opencollective.com/react-three-fiber), or in crypto `BTC: 36fuguTPxGCNnYZSRdgdh6Ea94brCAjMbH`, `ETH: 0x6E3f79Ea1d0dcedeb33D3fC6c34d2B1f156F2682`.\n","gitHead":"126b0b90ff7042a812d8d6a2eb37c282b70383c0","license":"MIT","scripts":{"dev":"yarn --cwd ./examples start","test":"echo null","build":"rollup -c && rimraf dist/__tests__","eslint":"eslint --fix src/**/*.{ts,tsx}","prepare":"husky install","typegen":"tsc && mv dist/src/* dist && rm -rf dist/src || true","prebuild":"rimraf dist && npm run typegen","typecheck":"tsc --noEmit --emitDeclarationOnly false --strict --jsx react"},"_npmUser":{"name":"drcmda","email":"drcmda@gmail.com"},"homepage":"https://github.com/drcmda/react-three-fiber#readme","keywords":["react","renderer","fiber","three","threejs"],"collective":{"url":"https://opencollective.com/react-three-fiber","type":"opencollective"},"repository":{"url":"git+https://github.com/drcmda/react-three-fiber.git","type":"git"},"_npmVersion":"7.5.0","description":"A React renderer for Three.js (web and react-native)","directories":{},"lint-staged":{"*.{js,jsx,ts,tsx}":["eslint --fix"]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"sideEffects":false,"_nodeVersion":"15.8.0","dependencies":{"zustand":"^3.3.3","scheduler":"0.20.1","use-asset":"^1.0.2","tiny-emitter":"^2.1.0","utility-types":"^3.10.0","@babel/runtime":"^7.13.9","react-merge-refs":"^1.1.0","react-reconciler":"0.26.1","react-use-measure":"^2.0.3","resize-observer-polyfill":"^1.5.1"},"react-native":"dist/native.js","_hasShrinkwrap":false,"readmeFilename":"readme.md","devDependencies":{"jest":"^26.6.3","json":"^10.0.0","husky":"^5.1.3","react":"^16.11.0","three":"^0.122.0","eslint":"^7.21.0","rimraf":"^3.0.2","rollup":"^2.40.0","cypress":"^6.6.0","expo-gl":"^10.1.0","ts-jest":"^26.5.3","wait-on":"^5.2.1","jest-cli":"^26.6.3","prettier":"^2.2.1","copyfiles":"^2.4.1","puppeteer":"^8.0.0","react-dom":"^16.11.0","expo-three":"^5.6.2","typescript":"^4.2.2","@babel/core":"7.13.8","@types/jest":"^26.0.20","lint-staged":"^10.5.4","@types/react":"^17.0.2","@types/three":"^0.126.0","babel-eslint":"^10.1.0","react-native":"^0.63.4","jest-puppeteer":"^4.4.0","@types/lodash-es":"^4.17.4","@types/react-dom":"^17.0.1","@types/scheduler":"^0.16.1","@babel/preset-env":"7.13.9","eslint-plugin-jest":"^24.1.5","rollup-plugin-json":"^4.0.0","@babel/preset-react":"7.12.13","@types/react-native":"^0.63.50","eslint-plugin-react":"^7.22.0","jest-image-snapshot":"^4.4.0","react-test-renderer":"^17.0.1","rollup-plugin-babel":"^4.4.0","@rollup/plugin-strip":"^2.0.0","eslint-plugin-import":"^2.22.1","rollup-plugin-terser":"^7.0.2","@rollup/plugin-inject":"^4.0.2","eslint-config-prettier":"^8.1.0","eslint-plugin-prettier":"^3.3.1","rollup-plugin-commonjs":"^10.1.0","@rollup/plugin-commonjs":"^17.1.0","@types/react-reconciler":"^0.26.0","@babel/preset-typescript":"^7.13.0","@typescript-eslint/parser":"^4.16.1","eslint-plugin-react-hooks":"^4.2.0","@types/react-test-renderer":"^17.0.1","rollup-plugin-node-resolve":"^5.2.0","@babel/helper-call-delegate":"^7.12.13","rollup-plugin-size-snapshot":"^0.12.0","eslint-import-resolver-alias":"^1.1.2","@babel/plugin-transform-runtime":"7.13.9","@typescript-eslint/eslint-plugin":"^4.16.1","@babel/plugin-transform-parameters":"7.13.0","@babel/plugin-transform-modules-commonjs":"7.13.8","@babel/plugin-transform-template-literals":"7.13.0","@ampproject/rollup-plugin-closure-compiler":"^0.26.0","babel-plugin-transform-react-remove-prop-types":"^0.4.24"},"peerDependencies":{"react":">=17.0","three":">=0.126","react-dom":">=17.0"},"_npmOperationalInternal":{"tmp":"tmp/react-three-fiber_6.0.0-alpha.3_1615032090134_0.11247916766411103","host":"s3://npm-registry-packages"},"_id":"react-three-fiber@6.0.0-alpha.3","version":"6.0.0-alpha.3"}