Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit e266b1d

Browse files
jahnliwebfansplz
andauthored
feat(assets): add scroll driven animations (#150)
Co-authored-by: webfansplz <[email protected]>
1 parent b02247e commit e266b1d

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

packages/client/components/AssetGridItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const path = computed(() => {
1212
</script>
1313

1414
<template>
15-
<button flex="~ col gap-1" hover="bg-active" items-center of-hidden rounded p2>
15+
<button class="scroll-driven-animations" flex="~ col gap-1" hover="bg-active" items-center of-hidden rounded p2>
1616
<AssetPreview h-30 w-30 rounded border="~ base" :asset="asset" />
1717
<div w-full of-hidden truncate ws-nowrap text-center text-xs>
1818
{{ path }}

packages/client/components/AssetListItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const icon = computed(() => {
1717
</script>
1818

1919
<template>
20-
<button flex="~ gap-1" w-full items-center hover="bg-active" rounded px4 py2>
20+
<button class="scroll-driven-animations" flex="~ gap-1" w-full items-center hover="bg-active" rounded px4 py2>
2121
<div :class="icon" />
2222
<div of-hidden truncate ws-nowrap text-center>
2323
{{ asset.path }}

packages/client/styles/main.css

+15
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,18 @@ textarea {
186186
.popup-dialog p {
187187
--uno: my-4;
188188
}
189+
190+
@keyframes animate-in {
191+
0% { opacity: 0; transform: translateY(100%); }
192+
100% { opacity: 1; transform: translateY(0); }
193+
}
194+
@keyframes animate-out {
195+
0% { opacity: 1; transform: translateY(0); }
196+
100% { opacity: 0; transform: translateY(-100%); }
197+
}
198+
199+
.scroll-driven-animations {
200+
animation: animate-in linear forwards, animate-out linear forwards;
201+
animation-timeline: view();
202+
animation-range: entry, exit;
203+
}

0 commit comments

Comments
 (0)