I am currently working on my upcoming website and I could use some guidance in this area.
My goal is to create a seamless horizontal scrolling effect on the page at a readable speed, but I'm having difficulty achieving this.
*,
*::after,
*::before {
box-sizing: border-box;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
margin: 0;
--color-text: #dedede;
--color-bg: #060606;
color: var(--color-text);
background-color: var(--color-bg);
}
.hero {
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
padding: 10vh 0 25vh;
--marquee-width: 100vw;
--offset: 20vw;
--move-initial: calc(-25% + var(--offset));
--move-final: calc(-50% + var(--offset));
--item-font-size: 8vw;
counter-reset: hero;
}
.marquee {
position: absolute;
top: 0;
left: 0;
width: var(--marquee-width);
overflow: hidden;
pointer-events: none;
mix-blend-mode: normal;
}
.marquee__inner {
width: fit-content;
display: flex;
position: relative;
transform: translate3d(var(--move-initial), -0, 0);
animation: marquee 5s linear infinite;
animation-play-state: paused;
opacity: 0;
transition: opacity 0.1s;
}
.marquee .marquee__inner {
animation-play-state: running;
opacity: 1;
transition-duration: 0.4s;
}
.marquee span {
text-align: center;
white-space: nowrap;
font-size: var(--item-font-size);
padding: 0 1vw;
font-weight: 900;
line-height: 1.15;
font-style: regular;
color: #FFFB00;
}
@keyframes marquee {
0% {
transform: translate3d(var(--move-initial), 0, 0);
}
100% {
transform: translate3d(var(--move-final), 0, 0);
}
<div>
<nav class="hero">
<div class="hero__item">
<div class="marquee">
<div class="marquee__inner" style="--tw: 189ch; --ad: 12s;">
<span>Logo Design • Brand Identity • Illustration • Icon Design • UX/UI • Logo Design
</span>
</div>
</div>
</div>
</nav>
</div>
I've attempted to adjust the keyframes and animation for the marquee, but I'm unsure why it's not scrolling smoothly.
Here is the link to the code on CodePenhttps://codepen.io/onuohaui/details/JjvNyaJ
Thank you for your assistance.