Files
MattrixwvReactComponents/lib/component/loading/drop/QuickDrop.tsx

110 lines
2.2 KiB
TypeScript

import type { LoadingPulseProps } from "$/types/Loading";
export default function QuickDrop({
width,
height,
className,
animationDuration = 1.2,
stroke,
fill
}: LoadingPulseProps){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-multiple.svg
const id = crypto.randomUUID().replaceAll("-", "");
return (
<svg
width={width}
height={height}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<circle
cx="12"
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
>
<animate
id={`drop1_${id}`}
begin={`0;drop3_${id}.end`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`0;drop3_${id}.end`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
</circle>
<circle
cx="12"
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
>
<animate
id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 6}`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 6}`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
</circle>
<circle
cx="12"
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
>
<animate
id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 3}`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
</circle>
</svg>
);
}