-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathAuroraBackground.vue
71 lines (63 loc) · 2.34 KB
/
AuroraBackground.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
<main>
<div
v-bind="props"
:class="
cn(
'relative flex flex-col h-[100vh] items-center justify-center bg-zinc-50 dark:bg-zinc-900 text-slate-950 transition-bg',
props.class,
)
"
>
<div class="absolute inset-0 overflow-hidden">
<div
:class="
cn(
'filter blur-[10px] invert dark:invert-0 pointer-events-none absolute -inset-[10px] opacity-50 will-change-transform;',
'[--white-gradient:repeating-linear-gradient(100deg,var(--white)_0%,var(--white)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--white)_16%)]',
'[--dark-gradient:repeating-linear-gradient(100deg,var(--black)_0%,var(--black)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--black)_16%)]',
'[--aurora:repeating-linear-gradient(100deg,var(--blue-500)_10%,var(--indigo-300)_15%,var(--blue-300)_20%,var(--violet-200)_25%,var(--blue-400)_30%)]',
'[background-image:var(--white-gradient),var(--aurora)] dark:[background-image:var(--dark-gradient),var(--aurora)] [background-size:300%,_200%] [background-position:50%_50%,50%_50%]',
'aurora-background-gradient-after',
'aurora-gradient-animation',
props.radialGradient &&
`[mask-image:radial-gradient(ellipse_at_100%_0%,black_10%,var(--transparent)_70%)]`,
)
"
></div>
</div>
<slot />
</div>
</main>
</template>
<script setup lang="ts">
import { cn } from "@/lib/utils";
interface AuroraBackgroundProps {
radialGradient?: boolean;
class?: string;
}
const props = withDefaults(defineProps<AuroraBackgroundProps>(), {
radialGradient: true,
});
</script>
<style scoped>
@import "tailwindcss";
.aurora-background-gradient-after {
@apply after:content-[""] after:absolute after:inset-0 after:[background-image:var(--white-gradient), var(--aurora)] after:dark:[background-image:var(--dark-gradient), var(--aurora)] after:[background-size:200%, _100%] after:[background-attachment:fixed] after:mix-blend-difference;
}
.aurora-gradient-animation::after {
animation: animate-aurora 60s linear infinite;
}
@keyframes animate-aurora {
0% {
background-position:
50% 50%,
50% 50%;
}
100% {
background-position:
350% 50%,
350% 50%;
}
}
</style>