mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 13:43:59 -05:00
92 lines
1.7 KiB
TypeScript
92 lines
1.7 KiB
TypeScript
import type { LoadingVariousProps } from "$/types/Loading";
|
|
|
|
|
|
export default function SpinningBinary({
|
|
width,
|
|
height,
|
|
className,
|
|
animationDuration = 2,
|
|
stroke,
|
|
fill
|
|
}: LoadingVariousProps){
|
|
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/gooey-balls-2.svg
|
|
const id = crypto.randomUUID().replaceAll("-", "");
|
|
|
|
|
|
return (
|
|
<svg
|
|
width={width}
|
|
height={height}
|
|
viewBox="0 0 24 24"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<defs>
|
|
<filter
|
|
id={`spinningBinaryFilter_${id}`}
|
|
>
|
|
<feGaussianBlur
|
|
in="SourceGraphic"
|
|
stdDeviation="1"
|
|
result="y"
|
|
/>
|
|
<feColorMatrix
|
|
in="y"
|
|
mode="matrix"
|
|
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7"
|
|
result="z"
|
|
/>
|
|
<feBlend
|
|
in="SourceGraphic"
|
|
in2="z"
|
|
/>
|
|
</filter>
|
|
</defs>
|
|
<g
|
|
filter={`url(#spinningBinaryFilter_${id})`}
|
|
>
|
|
<circle
|
|
cx="5"
|
|
cy="12"
|
|
r="4"
|
|
className={className}
|
|
stroke={stroke}
|
|
fill={fill}
|
|
>
|
|
<animate
|
|
attributeName="cx"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="5;8;5"
|
|
keySplines=".36,.62,.43,.99;.79,0,.58,.57"
|
|
repeatCount="indefinite"
|
|
/>
|
|
</circle>
|
|
<circle
|
|
cx="19"
|
|
cy="12"
|
|
r="4"
|
|
className={className}
|
|
stroke={stroke}
|
|
fill={fill}
|
|
>
|
|
<animate
|
|
attributeName="cx"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="19;16;19"
|
|
keySplines=".36,.62,.43,.99;.79,0,.58,.57"
|
|
repeatCount="indefinite"
|
|
/>
|
|
</circle>
|
|
<animateTransform
|
|
attributeName="transform"
|
|
type="rotate"
|
|
dur={animationDuration * 3 / 8}
|
|
values="0 12 12;360 12 12"
|
|
repeatCount="indefinite"
|
|
/>
|
|
</g>
|
|
</svg>
|
|
);
|
|
}
|