mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 13:43:59 -05:00
158 lines
3.5 KiB
TypeScript
158 lines
3.5 KiB
TypeScript
import type { LoadingBarsProps } from "$/types/Loading";
|
|
|
|
|
|
export default function CenterGrowingBars({
|
|
width,
|
|
height,
|
|
className,
|
|
animationDuration = 0.6,
|
|
stroke,
|
|
fill
|
|
}: LoadingBarsProps){
|
|
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-scale-middle.svg
|
|
const id = crypto.randomUUID().replaceAll("-", "");
|
|
|
|
|
|
return (
|
|
<svg
|
|
width={width}
|
|
height={height}
|
|
viewBox="0 0 24 24"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<rect
|
|
x="1"
|
|
y="6"
|
|
width="2.8"
|
|
height="12"
|
|
className={className}
|
|
stroke={stroke}
|
|
fill={fill}
|
|
>
|
|
<animate
|
|
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`}
|
|
attributeName="y"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="6;1;6"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
<animate
|
|
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`}
|
|
attributeName="height"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="12;22;12"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
</rect>
|
|
<rect
|
|
x="5.8"
|
|
y="6"
|
|
width="2.8"
|
|
height="12"
|
|
className={className}
|
|
stroke={stroke}
|
|
fill={fill}
|
|
>
|
|
<animate
|
|
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`}
|
|
attributeName="y"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="6;1;6"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
<animate
|
|
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`}
|
|
attributeName="height"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="12;22;12"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
</rect>
|
|
<rect
|
|
x="10.6"
|
|
y="6"
|
|
width="2.8"
|
|
height="12"
|
|
className={className}
|
|
stroke={stroke}
|
|
fill={fill}
|
|
>
|
|
<animate
|
|
id={`rectangle3_${id}`}
|
|
begin={`0;rectangle5_${id}.end-${animationDuration / 6}s`}
|
|
attributeName="y"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="6;1;6"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
<animate
|
|
begin={`0;rectangle5_${id}.end-${animationDuration / 6}s`}
|
|
attributeName="height"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="12;22;12"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
</rect>
|
|
<rect
|
|
x="15.4"
|
|
y="6"
|
|
width="2.8"
|
|
height="12"
|
|
className={className}
|
|
stroke={stroke}
|
|
fill={fill}
|
|
>
|
|
<animate
|
|
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`}
|
|
attributeName="y"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="6;1;6"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
<animate
|
|
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`}
|
|
attributeName="height"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="12;22;12"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
</rect>
|
|
<rect
|
|
x="20.2"
|
|
y="6"
|
|
width="2.8"
|
|
height="12"
|
|
className={className}
|
|
stroke={stroke}
|
|
fill={fill}
|
|
>
|
|
<animate
|
|
id={`rectangle5_${id}`}
|
|
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`}
|
|
attributeName="y"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="6;1;6"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
<animate
|
|
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`}
|
|
attributeName="height"
|
|
calcMode="spline"
|
|
dur={animationDuration}
|
|
values="12;22;12"
|
|
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
|
|
/>
|
|
</rect>
|
|
</svg>
|
|
);
|
|
}
|