Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!