After implementing TweenMax from Gsap, I created a landing page intro with a loading container containing three divs, each with a h5 element positioned in the center using absolute positioning. Initially, I used StaggerFrom {opacity 0} to staggerTo {opacity 1}. However, upon reloading the page, I noticed that all three h5 elements appear stacked on top of each other for a brief moment.
https://codepen.io/pranaymajee/pen/PomMaVM
Although it works fine on Codepen, I'm facing issues on my browser.
TweenMax.to(
".loadcon",
2, {
y: "-100%",
ease: Expo.easeInOut,
delay: 6,
},
);
TweenMax.staggerFrom(
".loadtext",
1, {
x: "-80",
ease: Power3.easeInOut,
opacity: "0",
},
2
);
TweenMax.staggerTo(
".loadtext",
0.8, {
x: "80",
ease: Power3.easeInOut,
delay: 1.2,
opacity: "0",
},
2
);
* {
margin: 0;
padding: 0;
text-decoration: none;
box-sizing: border-box;
text-rendering: optimizeLegibility;
}
.loadcon{
background-color: #000000;
height: 100vh;
width: 100vw;
z-index: 10;
position: fixed;
display: flex;
justify-content: center;
align-items: center;
}
.loadtext{
position: absolute;
top: 50%
left: 50%;
transform: translate(-50%,-50%);
}
.loadtext h5{
font-family: "Cyrene";
color: #fff;
font-size: 200px;
position: absolute;
top: 50%
left: 50%;
transform: translate(-50%,-50%);
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div class="loadcon">
<div class="loadtext">
<h5>Learn</h5>
</div>
<div class="loadtext">
<h5>Code</h5>
</div>
<div class="loadtext">
<h5>Repeat</h5>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TweenMax.min.js"></script>
</body>
</html>
The issue seems to persist in my browser even though it works on CodePen. Any suggestions?