feat: animate the vault accretion disk

This commit is contained in:
2026-11-09 22:40:09 +07:00
parent 34154b2ef1
commit 3a0259cbdd
4 changed files with 34 additions and 13 deletions

View File

@@ -1,4 +1,6 @@
import { memo, useId } from "react";
import { memo, useId, type Ref } from "react";
const LENS_ARC = "M-115 12 C-68 9 -67 -66 -9 -68 C52 -71 61 -10 111 6";
const streams = [
{ rx: 122, ry: 19, y: 10, width: 0.7, opacity: 0.30 },
@@ -9,11 +11,11 @@ const streams = [
{ rx: 66, ry: 12, y: 15, width: 0.9, opacity: 0.75 },
];
export const VaultCore = memo(function VaultCore() {
export const VaultCore = memo(function VaultCore({ ref }: { ref: Ref<SVGGElement> }) {
const id = useId();
const paint = (name: string) => `url(#${id}-${name})`;
return (
<g data-vault-core pointerEvents="none">
<g ref={ref} data-vault-core pointerEvents="none">
<defs>
<radialGradient id={`${id}-halo`}>
<stop stopColor="#e78347" stopOpacity=".2" />
@@ -44,17 +46,21 @@ export const VaultCore = memo(function VaultCore() {
<ellipse rx="162" ry="81" cy="6" fill={paint("halo")} />
<g transform="rotate(-11)">
<path
d="M-115 12 C-68 9 -67 -66 -9 -68 C52 -71 61 -10 111 6 M-114 13 C-62 38 -28 53 13 51 C54 48 89 27 111 6"
d={`${LENS_ARC} M-114 13 C-62 38 -28 53 13 51 C54 48 89 27 111 6`}
fill="none" stroke={paint("lens")} strokeWidth="11" opacity=".42" filter={paint("bloom")}
/>
<path
d="M-115 12 C-68 9 -67 -66 -9 -68 C52 -71 61 -10 111 6"
d={LENS_ARC}
fill="none" stroke={paint("lens")} strokeWidth="3.4" filter={paint("soft")}
/>
<path
d="M-103 12 C-59 5 -61 -61 -8 -63 C42 -66 55 -12 99 7"
fill="none" stroke={paint("lens")} strokeWidth="1.2" opacity=".8"
/>
<path
className="accretion-flow" d={LENS_ARC} pathLength="100" strokeDasharray="8 37 11 44"
fill="none" stroke={paint("lens")} strokeWidth="2.5" strokeLinecap="round" opacity=".8"
/>
<ellipse cy="12" rx="115" ry="17" fill="none" stroke={paint("disk")} strokeWidth="6" opacity=".35" />
<circle r="49" fill="#030405" />
<circle r="49.6" fill="none" stroke={paint("lens")} strokeWidth="1.15" opacity=".78" />
@@ -66,6 +72,14 @@ export const VaultCore = memo(function VaultCore() {
fill="none" stroke={paint("disk")} strokeWidth={width} opacity={opacity}
/>
))}
<path
className="accretion-flow" d="M-116 11 A116 19 0 0 0 116 11" pathLength="100"
strokeDasharray="17 28 9 46" fill="none" stroke={paint("disk")} strokeWidth="2.8" strokeLinecap="round"
/>
<path
className="accretion-flow accretion-flow--inner" d="M-79 14 A79 14 0 0 0 79 14" pathLength="100"
strokeDasharray="12 24 19 45" fill="none" stroke={paint("disk")} strokeWidth="2" strokeLinecap="round"
/>
<path d="M-76 20 C-39 34 32 39 82 21" fill="none" stroke={paint("disk")} strokeWidth=".85" opacity=".7" />
</g>
</g>