Compare commits

..

No commits in common. "802a3ed5bf403200341c84bdbfea28a6d823d59c" and "6151dd5a31c3b0251edc7aee3d6fcb755f4dc443" have entirely different histories.

6 changed files with 70 additions and 73 deletions

View file

@ -99,10 +99,6 @@ columns:
uploads: uploads:
template: image template: image
help: Petite image carrée représentant le jeu help: Petite image carrée représentant le jeu
galleryBackgroundColor:
label: Couleur d'arrière-plan de la galerie animée
type: color
alpha: false
keywords: keywords:
label: Mots clés label: Mots clés
type: structure type: structure

View file

@ -13,8 +13,7 @@ $specificData = [
'srcset' => $f->srcset('gallery'), 'srcset' => $f->srcset('gallery'),
'webp' => $f->srcset('gallery-webp'), 'webp' => $f->srcset('gallery-webp'),
])->values(), ])->values(),
'mockup' => $project->mockup()->toFile()?->url(), 'mockup' => $project->mockup()->toFile()?->url(),
'gallery_background_color' => $project->galleryBackgroundColor()->value(),
'keywords' => $project->keywords()->toStructure()->map(fn($i) => [ 'keywords' => $project->keywords()->toStructure()->map(fn($i) => [
'label' => $i->label()->value(), 'label' => $i->label()->value(),
'text' => $i->text()->value(), 'text' => $i->text()->value(),

View file

@ -4,7 +4,7 @@
* @prop {Array<{src: string, srcset: string, webp: string}>} images * @prop {Array<{src: string, srcset: string, webp: string}>} images
* @prop {number} secondsPerImage — durée par image (défaut: 8s) * @prop {number} secondsPerImage — durée par image (défaut: 8s)
*/ */
let { images = [], secondsPerImage = 8, backgroundColor = null } = $props() let { images = [], secondsPerImage = 8 } = $props()
const columns = $derived.by(() => { const columns = $derived.by(() => {
const count = images.length const count = images.length
@ -29,7 +29,7 @@
<div <div
class="gallery-animation gallery-animation--vertical" class="gallery-animation gallery-animation--vertical"
style="--gallery-duration: {columns[0]?.duration ?? 24}s{backgroundColor ? `; --background-color: ${backgroundColor}` : ''}" style="--gallery-duration: {columns[0]?.duration ?? 24}s"
> >
{#each columns as col} {#each columns as col}
<div class="gallery-animation__column"> <div class="gallery-animation__column">
@ -59,67 +59,3 @@
</div> </div>
{/each} {/each}
</div> </div>
<style>
.gallery-animation {
width: 100%;
height: 100%;
overflow: hidden;
background-color: var(--background-color, transparent);
}
/* Vertical mode (Portfolio) */
.gallery-animation--vertical {
display: flex;
flex-direction: row;
gap: 1rem;
}
.gallery-animation--vertical :global(.gallery-animation__column) {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.gallery-animation--vertical :global(.gallery-animation__track) {
display: flex;
flex-direction: column;
row-gap: 1rem;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.gallery-animation--vertical :global(.gallery-animation__column:nth-child(odd) .gallery-animation__track) {
animation-name: galleryScrollDown;
animation-duration: var(--gallery-duration);
}
.gallery-animation--vertical :global(.gallery-animation__column:nth-child(even) .gallery-animation__track) {
animation-name: galleryScrollUp;
animation-duration: var(--gallery-duration);
}
:global(.gallery-animation__image) {
width: 100%;
height: auto;
display: block;
object-fit: contain;
}
@keyframes galleryScrollDown {
from { transform: translateY(0); }
to { transform: translateY(-50%); }
}
@keyframes galleryScrollUp {
from { transform: translateY(-50%); }
to { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
:global(.gallery-animation__track) {
animation: none;
}
}
</style>

65
src/styles/gallery.css Normal file
View file

@ -0,0 +1,65 @@
/* Gallery animation */
:root {
--gallery-gap: 8px;
--gallery-duration: 24s;
}
.gallery-animation {
width: 100%;
height: 100%;
overflow: hidden;
}
/* Vertical mode (Portfolio) */
.gallery-animation--vertical {
display: flex;
flex-direction: row;
gap: var(--gallery-gap);
}
.gallery-animation--vertical .gallery-animation__column {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.gallery-animation--vertical .gallery-animation__track {
display: flex;
flex-direction: column;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.gallery-animation--vertical .gallery-animation__column:nth-child(odd) .gallery-animation__track {
animation-name: galleryScrollDown;
animation-duration: var(--gallery-duration);
}
.gallery-animation--vertical .gallery-animation__column:nth-child(even) .gallery-animation__track {
animation-name: galleryScrollUp;
animation-duration: var(--gallery-duration);
}
.gallery-animation__image {
width: 100%;
height: auto;
display: block;
object-fit: contain;
}
@keyframes galleryScrollDown {
from { transform: translateY(0); }
to { transform: translateY(-50%); }
}
@keyframes galleryScrollUp {
from { transform: translateY(-50%); }
to { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
.gallery-animation__track {
animation: none;
}
}

View file

@ -6,3 +6,4 @@
@import './buttons.css'; @import './buttons.css';
@import './cursor.css'; @import './cursor.css';
@import './utils.css'; @import './utils.css';
@import './gallery.css';

View file

@ -94,7 +94,7 @@
{#if currentProject} {#if currentProject}
<!-- Galerie animation (gauche) --> <!-- Galerie animation (gauche) -->
<div class="portfolio-gallery" aria-hidden="true"> <div class="portfolio-gallery" aria-hidden="true">
<GalleryAnimation images={currentProject.images_gallery} backgroundColor={currentProject.gallery_background_color} /> <GalleryAnimation images={currentProject.images_gallery} />
</div> </div>
<!-- Mockup device (centre) --> <!-- Mockup device (centre) -->