Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
My website has a lot of lag with React Three Fiber

I'm working on a website that for now, only has a text and a floating 3D logo on the right. The thing is, when I'm watching the object, the animation runs at 60fps and the website runs smoothly, but when I'm not watching the object, the website has a lot of lag and it's unusable so, I wanted to know why that happens and how I can fix it.

Here's my code:

index.js

<div className={styles.logo}>
    <Suspense fallback={null}>
        <Canvas gl={{antialias: true, powerPreference: 'high-performance'}} dpr={[0.8, 1.8]}>
            <Logo />
            <Environment background={false} files="/images/env2.hdr" near={1} far={1000} resolution={256} />
        </Canvas>
    </Suspense>
</div>

logo.js

export default function Logo({ ...props }) {
  const group = useRef()
  const { nodes, materials } = useGLTF('/images/RB_Maquillaje_2-transformed.glb')

  useFrame((state) => {
    const t = state.clock.getElapsedTime()
    group.current.position.y = Math.sin(t) * 0.2;
    group.current.rotation.y = Math.sin(t / 1.5) / 15
  })

  return (
    <group ref={group} {...props} dispose={null}>
      <motion.mesh initial={{scale: 0}} animate={{scale: 1}}
      transition={{duration: 0.5, type: 'spring', stiffness: 200, damping: 20}}
      geometry={nodes.BezierCurve004.geometry} material={materials['Material.001']} rotation={[0, -0.2, 0]} position={[0, -0.2, 1]} />
    </group>
  )
}

useGLTF.preload('/images/RB_Maquillaje_2-transformed.glb')
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda