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

95
Visualizações
Reveal animation not working as I'd like. Layout loading for split second then disappearing

So I have a reveal animation in my react app which uses ScrollReveal package and Im struggling to make it work properly.

The animation itself works great however I found that when I navigate through the app and come back to the home page where the layout is supposed to be revealed, the full layout shows up for a split second then disappears to begin the animation. I think its fair to want the animation to start right away and not have that gitter effect at the beggining. I currently have it in a useEffect cuz I thought that would fix it however it didn't. It also tried useLayoutEffect and it doesn't work.

The code for the home page component that gets revealed:

import React, { useEffect } from "react";
import ScrollReveal from "scrollreveal";
import {
    Title,
    HomeContainer,
    Subtitle,
    TitleButton,
  Hi,
  Name,
  ButtonContainer
} from "../../styles/Home-styles";

const Home = () => {
  useEffect(() => {
    ScrollReveal().reveal('.title' , {duration: 500, origin:"top", distance: "0.5em", delay: 0 , easing: "ease-in-out"});
    ScrollReveal().reveal('.subtitle', {duration: 500, origin:"top", distance: "1em", delay: 300, easing: "ease-in-out"});
    ScrollReveal().reveal('.button', {duration: 500, delay: 1000, distance: '0px', opacity: 0, easing: "ease-in-out"})
  
  }, []);


    return (
        <HomeContainer>
            <Title className="title">
                <Hi>Hi, </Hi>
                <Name>I'm Saif.</Name>
            </Title>
            <Subtitle className="subtitle">This is a subtitle</Subtitle>
            <ButtonContainer className="button">
                <TitleButton to="/about">button</TitleButton>
            </ButtonContainer>
        </HomeContainer>
    );
};

export default Home;
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your animation starts after a layout is rendered, because your useEffect hook is triggered after component is mounted. So first markup is rendered, only after that an animation takes place and force your elements to animate. Set initial CSS styles: hide elements behind the viewport using absolute positioning in CSS, use opacity: 0 and so on

about 4 years ago · Juan Pablo Isaza Relatório
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