Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

feat: add animated photo wall to cloud homepage

Timothy Yin9e53396b636b
diff --git a/apps/cloud/app/assets/cloud.css b/apps/cloud/app/assets/cloud.css
index 9c7c32b6..b3637bf5 100644
--- a/apps/cloud/app/assets/cloud.css
+++ b/apps/cloud/app/assets/cloud.css
@@ -83,58 +83,40 @@
}
.cf-gallery-preview {
position: relative;
- background: var(--card);
- padding: 20px;
- border: 1px solid var(--border);
- border-radius: 12px;
- transform: rotate(2deg);
- box-shadow: 0 24px 48px -32px #17211770;
-}
-.cf-preview-top {
- display: flex;
- justify-content: space-between;
- font-size: 8px;
- letter-spacing: 0.13em;
- color: var(--muted-foreground);
- margin-bottom: 16px;
-}
-.cf-preview-grid {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 8px;
-}
-.cf-preview-grid img {
- width: 100%;
- object-fit: cover;
- height: 150px;
- border-radius: 3px;
-}
-.cf-preview-grid img:first-child {
- grid-column: span 2;
- height: 260px;
-}
-.cf-preview-caption {
- display: flex;
- justify-content: space-between;
- margin-top: 14px;
- color: var(--muted-foreground);
- font-size: 9px;
-}
-.cf-preview-label {
- position: absolute;
- bottom: -20px;
- left: -24px;
- padding: 12px 18px;
+ aspect-ratio: 5 / 4;
+ overflow: hidden;
border: 1px solid var(--border);
- border-radius: 8px;
+ border-radius: 16px;
+ transform: perspective(1200px) rotateX(var(--tilt-x, 0deg)) rotateY(calc(-7deg + var(--tilt-y, 0deg))) rotateZ(2deg);
+ box-shadow: 0 30px 60px -35px #17211780, 0 8px 20px -12px #17211740;
background: var(--card);
- box-shadow: 0 6px 20px #00000008;
- display: flex;
- gap: 10px;
- align-items: center;
- font-size: 11px;
- transform: rotate(-2deg);
}
+.cf-preview-header { position: absolute; inset: 0 0 auto; z-index: 1; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; color: #20242b; }
+.cf-preview-header::before { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(to bottom, rgb(255 255 255 / 96%) 0%, rgb(255 255 255 / 92%) 25%, rgb(255 255 255 / 78%) 50%, rgb(255 255 255 / 42%) 75%, transparent 100%); pointer-events: none; }
+.dark .cf-preview-header { color: #f3f4f6; }
+.dark .cf-preview-header::before { background: linear-gradient(to bottom, rgb(37 38 41 / 96%) 0%, rgb(37 38 41 / 92%) 25%, rgb(37 38 41 / 78%) 50%, rgb(37 38 41 / 42%) 75%, transparent 100%); }
+.dark .cf-preview-identity span, .dark .cf-preview-info span { color: #d1d5db; }
+.dark .cf-preview-header svg { color: #e5e7eb; }
+.cf-preview-avatar { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: white; font-family: Georgia, serif; font-size: 15px; }
+.cf-preview-identity, .cf-preview-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
+.cf-preview-identity strong { font-size: 11px; white-space: nowrap; }
+.cf-preview-identity span, .cf-preview-info span { color: #4b5563; font-size: 8px; white-space: nowrap; }
+.cf-preview-info { flex: 1; margin-left: 8px; padding-left: 14px; border-left: 1px solid var(--border); }
+.cf-preview-info strong { font-size: 9px; }
+.cf-preview-header svg { width: 13px; height: 13px; flex: none; color: #374151; }
+.cf-photo-wall { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; height: 100%; padding: 8px; }
+.cf-photo-column { overflow: hidden; }
+.cf-photo-track { animation: cf-photo-scroll 95s linear infinite; }
+.cf-photo-column:nth-child(3) .cf-photo-track { animation-delay: -31s; }
+.cf-photo-column:nth-child(4) .cf-photo-track { animation-delay: -47s; }
+.cf-photo-column:nth-child(even) .cf-photo-track { animation-direction: reverse; animation-duration: 110s; }
+.cf-photo-sequence { display: grid; gap: 8px; padding-bottom: 8px; }
+.cf-photo-sequence img { display: block; width: 100%; height: 150px; object-fit: cover; border-radius: 4px; }
+.cf-photo-sequence img.cf-photo-1 { height: 210px; }
+.cf-photo-sequence img.cf-photo-2 { height: 175px; }
+@keyframes cf-photo-scroll { to { transform: translateY(-50%); } }
+@media (max-width: 420px) { .cf-preview-info { display: none; } .cf-preview-identity { flex: 1; } }
+@media (prefers-reduced-motion: reduce) { .cf-photo-track { animation: none; } }
.cf-section-heading {
display: flex;
justify-content: space-between;
@@ -811,6 +793,7 @@
padding: 50px 0;
}
}
+@media (max-width: 420px) { .cf-preview-info { display: none; } .cf-preview-identity { flex: 1; } }
@media (prefers-reduced-motion: reduce) {
.cf-root *,
.cf-error * {
@@ -3067,6 +3050,7 @@ a.cf-domain-address:hover {
transform: rotate(360deg);
}
}
+@media (max-width: 420px) { .cf-preview-info { display: none; } .cf-preview-identity { flex: 1; } }
@media (prefers-reduced-motion: reduce) {
.cf-payment-spinner {
animation: none;
diff --git a/apps/cloud/app/pages/index.vue b/apps/cloud/app/pages/index.vue
index f6027195..b742f766 100644
--- a/apps/cloud/app/pages/index.vue
+++ b/apps/cloud/app/pages/index.vue
@@ -8,10 +8,56 @@ import {
Image,
HardDrive,
Code2,
- Check,
+ Search,
+ SlidersHorizontal,
} from 'lucide-vue-next'
const entrance = useCloudMotion()
const links = useCloudLinks()
+const photoColumns = [
+ ['mountains', 'lake', 'forest', 'desert', 'coast', 'valley', 'waterfall', 'hills', 'sea'],
+ ['coast', 'waterfall', 'hills', 'forest', 'sea', 'mountains', 'lake', 'desert', 'valley'],
+ ['forest', 'valley', 'sea', 'lake', 'mountains', 'waterfall', 'desert', 'coast', 'hills'],
+ ['desert', 'mountains', 'coast', 'hills', 'waterfall', 'valley', 'forest', 'sea', 'lake'],
+].map(column => column.map(name => `/images/${name}.jpg`))
+const preview = ref<HTMLElement | null>(null)
+let frame = 0
+let currentX = 0
+let currentY = 0
+let targetX = 0
+let targetY = 0
+let lastTime = 0
+
+function animatePreview(time: number) {
+ const elapsed = lastTime ? Math.min(time - lastTime, 64) : 16
+ lastTime = time
+ const easing = 1 - Math.exp(-elapsed / 180)
+ currentX += (targetX - currentX) * easing
+ currentY += (targetY - currentY) * easing
+ preview.value?.style.setProperty('--tilt-x', `${currentX}deg`)
+ preview.value?.style.setProperty('--tilt-y', `${currentY}deg`)
+ if (Math.abs(targetX - currentX) + Math.abs(targetY - currentY) > 0.01) {
+ frame = requestAnimationFrame(animatePreview)
+ } else {
+ frame = 0
+ lastTime = 0
+ }
+}
+
+function updatePreview(event: PointerEvent) {
+ if (event.pointerType !== 'mouse' || matchMedia('(prefers-reduced-motion: reduce)').matches) return
+ const bounds = (event.currentTarget as HTMLElement).getBoundingClientRect()
+ targetX = (0.5 - (event.clientY - bounds.top) / bounds.height) * 8
+ targetY = ((event.clientX - bounds.left) / bounds.width - 0.5) * 10
+ if (!frame) frame = requestAnimationFrame(animatePreview)
+}
+
+function resetPreview() {
+ targetX = 0
+ targetY = 0
+ if (!frame) frame = requestAnimationFrame(animatePreview)
+}
+
+onBeforeUnmount(() => cancelAnimationFrame(frame))
useSeoMeta({
title: t('cloud.messages.chronoframeAHomeForYourPhotography'),
description: t(
@@ -63,42 +109,23 @@ useSeoMeta({
>
<motion.div v-bind="entrance"
><div
- class="cf-gallery-preview"
+ ref="preview" class="cf-gallery-preview" @pointermove="updatePreview" @pointerleave="resetPreview"
:aria-label="$t('cloud.messages.examplePhotographyGallery')"
>
- <div class="cf-preview-top">
- <span>{{ $t('cloud.messages.fieldNotes') }}</span
- ><span>{{ $t('cloud.messages.aChronoframeGallery') }}</span>
- </div>
- <div class="cf-preview-grid">
- <img
- src="/images/mountains.jpg"
- :alt="
- $t('cloud.messages.sunlitMountainPeaksBeneathASoftBlueSky')
- "
- width="1200"
- height="800"
- fetchpriority="high"
- /><img
- src="/images/forest.jpg"
- :alt="$t('cloud.messages.lightFallingThroughAQuietGreenForest')"
- width="800"
- height="600"
- /><img
- src="/images/coast.jpg"
- :alt="$t('cloud.messages.anOceanShoreInTheWarmLightOfSunset')"
- width="800"
- height="600"
- />
- </div>
- <div class="cf-preview-caption">
- <span>{{ $t('cloud.messages.smallMomentsWideHorizons') }}</span
- ><span>01 — 03</span>
+ <div class="cf-preview-header" aria-hidden="true">
+ <div class="cf-preview-avatar">C</div>
+ <div class="cf-preview-identity"><strong>My Memories</strong><span>A ChronoFrame gallery</span></div>
+ <div class="cf-preview-info"><strong>128 photos</strong><span>Small moments. Wide horizons.</span></div>
+ <Search :size="15" /><SlidersHorizontal :size="15" />
</div>
- <div class="cf-preview-label">
- <Check :size="16" /><span>{{
- $t('cloud.messages.aLittleSpaceForYourPerspective')
- }}</span>
+ <div class="cf-photo-wall" aria-hidden="true">
+ <div v-for="(column, columnIndex) in photoColumns" :key="columnIndex" class="cf-photo-column">
+ <div class="cf-photo-track">
+ <div v-for="copy in 2" :key="copy" class="cf-photo-sequence">
+ <img v-for="(photo, index) in column" :key="photo" :src="photo" :class="`cf-photo-${(index + columnIndex) % 3}`" alt="" width="400" height="300" />
+ </div>
+ </div>
+ </div>
</div>
</div></motion.div
>
diff --git a/apps/cloud/public/images/desert.jpg b/apps/cloud/public/images/desert.jpg
new file mode 100644
index 00000000..ac59eb1f
Binary files /dev/null and b/apps/cloud/public/images/desert.jpg differ
diff --git a/apps/cloud/public/images/hills.jpg b/apps/cloud/public/images/hills.jpg
new file mode 100644
index 00000000..1d923e0a
Binary files /dev/null and b/apps/cloud/public/images/hills.jpg differ
diff --git a/apps/cloud/public/images/lake.jpg b/apps/cloud/public/images/lake.jpg
new file mode 100644
index 00000000..6702e441
Binary files /dev/null and b/apps/cloud/public/images/lake.jpg differ
diff --git a/apps/cloud/public/images/sea.jpg b/apps/cloud/public/images/sea.jpg
new file mode 100644
index 00000000..4bf40b93
Binary files /dev/null and b/apps/cloud/public/images/sea.jpg differ
diff --git a/apps/cloud/public/images/valley.jpg b/apps/cloud/public/images/valley.jpg
new file mode 100644
index 00000000..873c8616
Binary files /dev/null and b/apps/cloud/public/images/valley.jpg differ
diff --git a/apps/cloud/public/images/waterfall.jpg b/apps/cloud/public/images/waterfall.jpg
new file mode 100644
index 00000000..2e0fcb5c
Binary files /dev/null and b/apps/cloud/public/images/waterfall.jpg differ