Skip to content

Commit 9f7877a

Browse files
authored
Merge pull request #35 from binhtran432k/fix/animation
fix: use customized animation
2 parents 2be7b3a + 10e9554 commit 9f7877a

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

src/components/scroll-down/scroll-down.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
import { component$ } from "@builder.io/qwik";
2-
import { clsx } from "clsx";
32

43
export default component$(() => {
54
return (
65
<button class="flex flex-col items-center" aria-label="Scroll down">
76
<div class="flex h-10 w-6 justify-center rounded-xl border-2 border-current">
8-
<div class="mt-2 h-3 animate-bounce [animation-duration:300ms]">
9-
<div class="h-1 w-1 animate-bounce rounded-[50%] bg-current [animation-duration:300ms]" />
10-
</div>
7+
<div class="mt-2 h-1 w-1 animate-deepBounce rounded-[50%] bg-current [animation-duration:300ms]" />
118
</div>
129
<div class="mb-3 flex flex-col py-1">
13-
{[...Array(3)].map((_, i) => (
14-
<div
15-
key={i}
16-
class={clsx(
17-
"h-3 w-3 rotate-45 animate-[pulse_1s_ease-in-out_alternate_infinite] border-b-2 border-r-2 border-current opacity-25",
18-
i > 0 && `[animation-delay:${(i * 100).toFixed(0)}ms]`,
19-
)}
20-
/>
21-
))}
10+
<div class="h-3 w-3 rotate-45 animate-deepPulse border-b-2 border-r-2 border-current opacity-25 [animation-delay:100ms]" />
11+
<div class="h-3 w-3 rotate-45 animate-deepPulse border-b-2 border-r-2 border-current opacity-25 [animation-delay:200ms]" />
12+
<div class="h-3 w-3 rotate-45 animate-deepPulse border-b-2 border-r-2 border-current opacity-25 [animation-delay:300ms]" />
2213
</div>
2314
</button>
2415
);

src/components/social/social-link.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ export default component$(
55
({ label, href, icon }: { label: string; href: string; icon: JSXOutput }) => {
66
return (
77
<div class="group relative flex place-items-center">
8-
<span class="absolute left-0 top-0 origin-[38%48%] text-info group-hover:animate-spin group-hover:[animation-duration:200ms]">
8+
<span class="absolute left-0 top-0 hidden text-info group-hover:block group-hover:animate-around group-hover:[animation-duration:200ms]">
99
{icon}
1010
</span>
11-
<span class="absolute left-0 top-0 origin-[58%40%] text-danger group-hover:animate-spin group-hover:[animation-duration:200ms] group-hover:[animation-delay:100ms]">
11+
<span class="absolute left-0 top-0 hidden text-danger group-hover:block group-hover:animate-around group-hover:[animation-duration:200ms] group-hover:[animation-delay:100ms]">
1212
{icon}
1313
</span>
1414
<Link

tailwind.config.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,30 @@ export default {
1515
foreground: colors.gray["50"],
1616
background: colors.gray["950"],
1717
},
18-
extend: {},
18+
extend: {
19+
keyframes: {
20+
deepPulse: {
21+
"0%, 100%": { opacity: 1 },
22+
"50%": { opacity: 0 },
23+
},
24+
deepBounce: {
25+
"0%, 100%": { transform: "translateY(-50%)" },
26+
"50%": { transform: "translateY(0)" },
27+
},
28+
around: {
29+
"0%": { transform: "translate3d(12%,-12%,0)" },
30+
"25%": { transform: "translate3d(12%,12%,0)" },
31+
"50%": { transform: "translate3d(-12%,12%,0)" },
32+
"75%": { transform: "translate3d(-12%,-12%,0)" },
33+
"100%": { transform: "translate3d(0,0,0)" },
34+
},
35+
},
36+
animation: {
37+
deepPulse: "deepPulse 1s alternate infinite",
38+
deepBounce: "deepBounce 1s infinite",
39+
around: "around 1s infinite",
40+
},
41+
},
1942
},
2043
plugins: [],
2144
};

0 commit comments

Comments
 (0)