UNPKG

glodrei

Version:

useful add-ons for react-three-fiber

18 lines (13 loc) 458 B
--- title: useFont sourcecode: src/core/useFont.tsx --- Uses THREE.FontLoader to load a font and returns a `THREE.Font` object. It also accepts a JSON object as a parameter. You can use this to preload or share a font across multiple components. ```jsx const font = useFont('/fonts/helvetiker_regular.typeface.json') return <Text3D font={font} /> ``` In order to preload you do this: ```jsx useFont.preload('/fonts/helvetiker_regular.typeface.json') ```