You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use TextGeometry on my Gatsby site but I can't get it to render.
At first I encountered errors like maxY undefined and font parameter is not an instance of THREE.Font which I think I managed to resolve by moving the font I'm loading into the public folder. However nothing renders on my site despite having no errors.
import * as React from "react"
import { Canvas, useFrame, useLoader} from "@react-three/fiber"
import { FontLoader } from "three/src/loaders/FontLoader"
function Text(props) {
const mesh = React.useRef()
const font = useLoader(FontLoader, "./helvetiker_regular.json")
const config = React.useMemo(
() => ({ font, size: 40, height: 30, curveSegments: 32, bevelEnabled: true, bevelThickness: 6, bevelSize: 2.5, bevelOffset: 0, bevelSegments: 8 }),
[font]
)
return (
<mesh
{...props}
ref = {mesh}
>
<textGeometry args={["hello this is a test", config]} />
<meshStandardMaterial color="orange" />
</mesh>
)
}
Is it because the font needs to be called as a callback function from the loader? But I didn't see anything like that in the demo that uses TextGeometry from the doc examples. Any help would be appreciated!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to use TextGeometry on my Gatsby site but I can't get it to render.
At first I encountered errors like
maxY undefined
andfont parameter is not an instance of THREE.Font
which I think I managed to resolve by moving the font I'm loading into thepublic
folder. However nothing renders on my site despite having no errors.and the render function
Is it because the font needs to be called as a callback function from the loader? But I didn't see anything like that in the demo that uses TextGeometry from the doc examples. Any help would be appreciated!
Link to source:
https://github.com/LinkCable/quatro/blob/main/src/pages/index.js
Beta Was this translation helpful? Give feedback.
All reactions