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

130
Visualizações
React Spring animation slowing down

I have a react-spring simple rotation animation with adjustable speed. But once I sett the speed to full (setting duration to 10ms) and returning it to lower even 1 second, it wouldn't animate properly and rather gets lagging.

Here is the animation preview https://3l3kb.csb.app/

And here is the sandbox https://codesandbox.io/s/spring-anim-test-forked-6wno4

And here is the code

export default function App() {
  const [reverse, setReverse] = useState(false);
  const [speed, setSpeed] = useState(50);

  const rotation = useSpring({
    from: { transform: "rotate(0deg)" },
    to: { transform: "rotate(360deg)" },
    loop: true,
    reset: true,
    config: { duration: 10 + (100 - speed) * 10 }
  });

  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      {/* <animated.div>
        <animated.h1>{num.get().toFixed(2)}</animated.h1>
      </animated.div> */}
      <div
        style={{
          width: "300px",
          height: "300px",
          position: "relative",
          margin: "auto"
        }}
      >
        <animated.div
          style={{
            ...{
              ...rotation,
              marginLeft: "auto",
              position: "absolute",
              color: "purple",
              fontSize: "130px"
            }
          }}
        >
          T
        </animated.div>
      </div>
      <input
        type="range"
        value={speed}
        onChange={(e) => setSpeed(e.target.value)}
        style={{
          marginTop: "100px",
          width: "500px"
        }}
      />
    </div>
  );
}
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