98 lines
1.7 KiB
CSS
98 lines
1.7 KiB
CSS
.marqueeText {
|
|
--animation-duration: 14000ms;
|
|
--scroll-distance: 0;
|
|
--marquee-background-color: transparent;
|
|
background-color: var(--marquee-background-color);
|
|
position: relative;
|
|
flex-shrink: 1;
|
|
min-width: 0;
|
|
overflow: hidden;
|
|
|
|
&:has(.overflowing) {
|
|
&::before {
|
|
content: "";
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
width: 12px;
|
|
background: linear-gradient(
|
|
to right,
|
|
var(--marquee-background-color) 0%,
|
|
transparent 100%
|
|
);
|
|
z-index: 2;
|
|
pointer-events: none;
|
|
opacity: 0;
|
|
animation: leftShadow var(--animation-duration) linear infinite;
|
|
}
|
|
|
|
&::after {
|
|
content: "";
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
width: 12px;
|
|
background: linear-gradient(
|
|
to left,
|
|
var(--marquee-background-color) 0%,
|
|
transparent 100%
|
|
);
|
|
z-index: 2;
|
|
pointer-events: none;
|
|
opacity: 1;
|
|
animation: rightShadow var(--animation-duration) linear infinite;
|
|
}
|
|
}
|
|
}
|
|
|
|
.textWrapper {
|
|
display: flex;
|
|
scrollbar-width: none;
|
|
align-items: center;
|
|
scroll-behavior: smooth;
|
|
|
|
* {
|
|
flex-shrink: 0;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
&.overflowing {
|
|
animation: autoScrollText var(--animation-duration) linear infinite;
|
|
}
|
|
}
|
|
|
|
@keyframes autoScrollText {
|
|
0%,
|
|
10% {
|
|
transform: translateX(0);
|
|
}
|
|
75%,
|
|
100% {
|
|
transform: translateX(calc(-1 * var(--scroll-distance)));
|
|
}
|
|
}
|
|
|
|
@keyframes leftShadow {
|
|
0%,
|
|
11% {
|
|
opacity: 0;
|
|
}
|
|
12%,
|
|
100% {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
@keyframes rightShadow {
|
|
0%,
|
|
74% {
|
|
opacity: 1;
|
|
}
|
|
75%,
|
|
100% {
|
|
opacity: 0;
|
|
}
|
|
}
|