Added gradient aura

This commit is contained in:
Alexis
2024-08-06 21:42:46 +02:00
parent a5d8b0f362
commit f04f8ad517

View File

@@ -5,8 +5,78 @@ import Layout from '../layouts/Layout.astro';
<Layout>
<main>
<section class="relative h-screen overflow-clip">
<Heading tag="h1">
Titre
</Heading>
<div class="absolute inset-0 -z-20 isolate">
<div id="shape-filter"></div>
<div id="shape" class="bg-gradient-to-tr from-emerald-500 from-35% via-indigo-500 via-70% to-fuchsia-500 to-100% opacity-30"></div>
</div>
<div class="absolute inset-0 -z-10 isolate grid place-items-center pointer-events-none" style="mask-image: radial-gradient(black, transparent);">
<svg class="col-start-1 row-start-1 opacity-15" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="grid" width="38" height="38" patternUnits="userSpaceOnUse">
<path d="M 100 0 L 0 0 0 38" fill="none" stroke="white" stroke-width="1"/>
</pattern>
</defs>
<rect width="100%" height="100%" fill="url(#grid)" />
</svg>
</div>
</section>
</main>
</Layout>
<script>
const shape = document.getElementById('shape')
if (shape) {
document.addEventListener('pointermove', (event) => {
const { clientX, clientY } = event;
shape.animate({
left: `${clientX}px`,
top: `${clientY}px`
}, { duration: 1500, fill: "forwards" })
})
}
</script>
<style lang="scss">
@keyframes shape-spin {
from {
rotate: 0deg;
}
50% {
scale: 1 1.5;
}
to {
rotate: 360deg;
}
}
#shape-filter {
height: 100%;
width: 100%;
position: absolute;
z-index: 2;
backdrop-filter: blur(12vmax);
}
#shape {
height: 30vmax;
position: absolute;
left: 50%;
top: 50%;
translate: -50% -50%;
border-radius: 50%;
aspect-ratio: 1;
}
#shape {
animation: shape-spin 17s infinite;
}
</style>