As I work on an animation where an img object and text slide in from outside the frame of the webpage upon page load, everything seems to be running smoothly. But there's one glaring issue: right at the start of the page load, the webpage resizes for about half a second. This happens because, at that moment, the img object is positioned outside the frame, causing the website to adjust its size accordingly. This results in a rather jerky effect during loading. Is there a way to make it so that the img object remains outside the current bounds of the frame and only becomes visible on the webpage once it partially enters the frame?
Below is the simple CSS code for the animation, along with the CSS for the image (set as a float to allow text wrapping).
Since I am using the React framework, I am also open to any React or JavaScript solutions that may help address this issue.
@keyframes slideFromRight {
0% {
transform: translateX(800px) translateY(-80px);
}
100% {
transform: translateX(0px) translateY(0px);
.img--berk {
float: right;
width: 335px;
height: 213px;
margin-top: 1%;
margin-right: 1%;
margin-left: 1%;
border-radius: 9%;
border: 4px solid var(--blue);
animation: slideFromRight 1.2s cubic-bezier(0.35,-0.15, 0.63, 1.58);
}