world-game/test_anim/style.css
2026-02-05 16:40:40 +01:00

159 lines
4.2 KiB
CSS

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
min-height: 100vh;
}
.gallery-animation {
--gap: 20px;
--half-gap: calc(var(--gap) / 2);
--vertical-wrapper-width: 900px;
--shadow-diffusion: 5px;
--gallery-animation-width: 40vw;
--max-portion : 0.7;
position: fixed;
top: 0;
left: 0;
width: var(--gallery-animation-width);
height: 100vh;
overflow: hidden;
}
.gallery-animation__wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
background-color: green;
}
.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: min(100%, calc(var(--gallery-animation-width) * var(--max-portion)));
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: var(--half-gap);
}
.gallery-animation--vertical .gallery-animation__image {
width: 100%;
height: auto;
/* height: calc(100vh * var(--max-portion)); */ /* */
object-fit: contain;
margin-block: var(--half-gap);
}
/* 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(--half-gap) 0;
height: auto;
}
.gallery-animation--horizontal .gallery-animation__column {
--gallery-animation__wrapper-inner-height: calc(100vh - var(--half-gap) * 2) ;
height: clamp(calc(var(--gallery-animation__wrapper-inner-height) / 5), calc(var(--gallery-animation-width) / 2), calc(var(--gallery-animation__wrapper-inner-height) / 3));
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: var(--half-gap);
}
.gallery-animation--horizontal .gallery-animation__image {
height: 100%;
width: auto;
object-fit: contain;
margin-inline: var(--half-gap);
}
/* 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;
}
}