A background component featuring an animated tunnel of rings with rising particles.
Installation
Usage
<script setup lang="ts">
import HoleBackground from '@/components/animate-ui/backgrounds/hole/HoleBackground.vue';
</script>
<template>
<section class="relative h-[480px] overflow-hidden">
<HoleBackground class="absolute inset-0" />
</section>
</template>Animation
- Rings slide down into a tunnel drawn on a canvas while particles rise out of it, under a glowing aurora that scrolls through its colors every 5s.
- The canvas is sized to its container at the device pixel ratio. The rings and particles advance one step per displayed frame, so they move faster on 120Hz screens.
- It pauses off screen and while the tab is hidden.
- Under reduced motion, the tunnel, the particles and the aurora hold still.
API Reference
HoleBackground
| Prop | Type | Default |
|---|---|---|
stroke-color? | string | '#737373' |
number-of-lines? | number | 50 |
number-of-discs? | number | 50 |
particle-r-g-b-color? | [number, number, number] | [255, 255, 255] |
...attrs? | HTMLAttributes | - |
Credits
- Credits to Antoine Wodniack for the inspiration