world-game/test_anim/style.css

153 lines
3.7 KiB
CSS
Raw Permalink Normal View History

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
min-height: 100vh;
}
.gallery-animation {
--gap: 40px;
--vertical-wrapper-width: 900px;
--shadow-diffusion: 10px;
position: fixed;
top: 0;
left: 0;
width: 40vw;
height: 100vh;
overflow: hidden;
}
.gallery-animation__wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
}
.gallery-animation__track {
display: flex;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.gallery-animation__image {
object-fit: cover;
flex-shrink: 0;
filter: drop-shadow(0px 0px var(--shadow-diffusion) rgb(0, 0, 0));
}
/* ==========================================================================
MODE VERTICAL
========================================================================== */
.gallery-animation--vertical .gallery-animation__wrapper{
width: var(--vertical-wrapper-width);
flex-direction: row;
justify-content: center;
padding: 0 var(--gap);
left: 50%;
transform: translateX(-50%);
}
.gallery-animation--vertical .gallery-animation__column {
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
overflow: hidden;
}
.gallery-animation--vertical .gallery-animation__track {
flex-direction: column;
align-items: stretch;
width: 100%;
padding-inline: calc(var(--gap) / 2);
}
.gallery-animation--vertical .gallery-animation__image {
width: 100%;
height: auto;
object-fit: contain;
margin-block: calc(var(--gap) / 2);
}
/* Animations verticales */
.gallery-animation--vertical .gallery-animation__column:nth-child(odd) .gallery-animation__track {
animation: scrollDown var(--animation-duration) linear infinite;
}
.gallery-animation--vertical .gallery-animation__column:nth-child(even) .gallery-animation__track {
animation: scrollUp var(--animation-duration) linear infinite;
}
@keyframes scrollDown {
from { transform: translateY(0); }
to { transform: translateY(-50%); }
}
@keyframes scrollUp {
from { transform: translateY(-50%); }
to { transform: translateY(0); }
}
/* ==========================================================================
MODE HORIZONTAL
========================================================================== */
.gallery-animation--horizontal .gallery-animation__wrapper {
flex-direction: column;
padding: var(--gap) 0;
}
.gallery-animation--horizontal .gallery-animation__column {
flex: 1;
display: flex;
flex-direction: row;
align-items: stretch;
overflow: hidden;
}
.gallery-animation--horizontal .gallery-animation__track {
flex-direction: row;
align-items: stretch;
height: 100%;
padding-block: calc(var(--gap) / 2);
}
.gallery-animation--horizontal .gallery-animation__image {
height: 100%;
width: auto;
object-fit: contain;
margin-inline: calc(var(--gap) / 2);
}
/* Animations horizontales */
.gallery-animation--horizontal .gallery-animation__column:nth-child(odd) .gallery-animation__track {
animation: scrollRight var(--animation-duration) linear infinite;
}
.gallery-animation--horizontal .gallery-animation__column:nth-child(even) .gallery-animation__track {
animation: scrollLeft var(--animation-duration) linear infinite;
}
@keyframes scrollRight {
from { transform: translateX(-50%); }
to { transform: translateX(0); }
}
@keyframes scrollLeft {
from { transform: translateX(0); }
to { transform: translateX(-50%); }
}
/* ==========================================================================
REDUCED MOTION
========================================================================== */
@media (prefers-reduced-motion: reduce) {
.gallery-animation__track {
animation: none !important;
}
}