Update loading components

This commit is contained in:
2026-02-24 22:16:46 -05:00
parent a61e7ce19a
commit 637b3a0c34
43 changed files with 1363 additions and 930 deletions

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function DoubleDrop({
size,
width,
height,
className,
animationDuration = 1.2,
animationDuration = 1200,
color,
stroke,
fill
}: LoadingPulseProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-2.svg
const id = crypto.randomUUID().replaceAll("-", "");
const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -25,24 +35,24 @@ export default function DoubleDrop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`drop1_${id}`}
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`}
begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`}
begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"
@@ -53,24 +63,24 @@ export default function DoubleDrop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 2}s`}
begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 2}s`}
begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function DoubleWaveDrop({
size,
width,
height,
className,
animationDuration = 1.2,
animationDuration = 1200,
color,
stroke,
fill
}: LoadingPulseProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-2.svg
const id = crypto.randomUUID().replaceAll("-", "");
const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -24,34 +34,34 @@ export default function DoubleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
id={`drop1_${id}`}
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`}
begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
/>
<animateTransform
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`}
begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="transform"
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
/>
<animate
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`}
begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
/>
@@ -60,34 +70,34 @@ export default function DoubleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 2}s`}
begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
/>
<animateTransform
begin={`drop1_${id}.begin+${animationDuration / 2}s`}
begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="transform"
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 2}s`}
begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
/>

View File

@@ -1,21 +1,30 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function Drop({
size,
width,
height,
className,
animationDuration = 1.2,
animationDuration = 1200,
color,
stroke,
fill
}: LoadingPulseProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -24,13 +33,13 @@ export default function Drop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
repeatCount="indefinite"
@@ -38,7 +47,7 @@ export default function Drop({
<animate
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
repeatCount="indefinite"

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function QuickDrop({
size,
width,
height,
className,
animationDuration = 1.2,
animationDuration = 1200,
color,
stroke,
fill
}: LoadingPulseProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-multiple.svg
const id = crypto.randomUUID().replaceAll("-", "");
const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -25,15 +35,15 @@ export default function QuickDrop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`drop1_${id}`}
begin={`0;drop3_${id}.end`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
@@ -42,7 +52,7 @@ export default function QuickDrop({
begin={`0;drop3_${id}.end`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"
@@ -53,24 +63,24 @@ export default function QuickDrop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 6}`}
begin={`drop1_${id}.begin+${dur / 6}`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 6}`}
begin={`drop1_${id}.begin+${dur / 6}`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"
@@ -81,24 +91,24 @@ export default function QuickDrop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}`}
begin={`drop1_${id}.begin+${dur / 3}`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 3}`}
begin={`drop1_${id}.begin+${dur / 3}`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function QuickWaveDrop({
size,
width,
height,
className,
animationDuration = 1.2,
animationDuration = 1200,
color,
stroke,
fill
}: LoadingPulseProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-multiple.svg
const id = crypto.randomUUID().replaceAll("-", "");
const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -24,8 +34,8 @@ export default function QuickWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
id={`drop1_${id}`}
@@ -33,7 +43,7 @@ export default function QuickWaveDrop({
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
/>
@@ -43,7 +53,7 @@ export default function QuickWaveDrop({
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
/>
@@ -51,7 +61,7 @@ export default function QuickWaveDrop({
begin={`0;drop3_${id}.end`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
/>
@@ -60,34 +70,34 @@ export default function QuickWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 6}s`}
begin={`drop1_${id}.begin+${dur / 6}s`}
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
/>
<animateTransform
begin={`drop1_${id}.begin+${animationDuration / 6}s`}
begin={`drop1_${id}.begin+${dur / 6}s`}
attributeName="transform"
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 6}s`}
begin={`drop1_${id}.begin+${dur / 6}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
/>
@@ -96,34 +106,34 @@ export default function QuickWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}s`}
begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
/>
<animateTransform
begin={`drop1_${id}.begin+${animationDuration / 3}s`}
begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="transform"
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 3}s`}
begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
/>

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function TripleDrop({
size,
width,
height,
className,
animationDuration = 1.2,
animationDuration = 1200,
color,
stroke,
fill
}: LoadingPulseProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-3.svg
const id = crypto.randomUUID().replaceAll("-", "");
const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -25,24 +35,24 @@ export default function TripleDrop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`drop1_${id}`}
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`}
begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`}
begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"
@@ -53,24 +63,24 @@ export default function TripleDrop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}s`}
begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 3}s`}
begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"
@@ -81,24 +91,24 @@ export default function TripleDrop({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;11"
keySplines=".52,.6,.25,.99"
fill="freeze"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
fill="freeze"

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function TripleWaveDrop({
size,
width,
height,
className,
animationDuration = 1.2,
animationDuration = 1200,
color,
stroke,
fill
}: LoadingPulseProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-3.svg
const id = crypto.randomUUID().replaceAll("-", "");
const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -24,34 +34,34 @@ export default function TripleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
id={`drop1_${id}`}
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`}
begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
/>
<animateTransform
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`}
begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="transform"
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
/>
<animate
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`}
begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
/>
@@ -60,34 +70,34 @@ export default function TripleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}s`}
begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
/>
<animateTransform
begin={`drop1_${id}.begin+${animationDuration / 3}s`}
begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="transform"
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration / 3}s`}
begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
/>
@@ -96,34 +106,34 @@ export default function TripleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
/>
<animateTransform
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="transform"
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
/>
<animate
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
/>

View File

@@ -1,21 +1,30 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function WaveDrop({
size,
width,
height,
className,
animationDuration = 1.2,
animationDuration = 1200,
color,
stroke,
fill
}: LoadingPulseProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-ring.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -23,14 +32,14 @@ export default function WaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
attributeName="transform"
calcMode="spline"
type="translate"
dur={animationDuration}
dur={dur}
values="12 12;0 0"
keySplines=".52,.6,.25,.99"
repeatCount="indefinite"
@@ -40,7 +49,7 @@ export default function WaveDrop({
calcMode="spline"
additive="sum"
type="scale"
dur={animationDuration}
dur={dur}
values="0;1"
keySplines=".52,.6,.25,.99"
repeatCount="indefinite"
@@ -48,7 +57,7 @@ export default function WaveDrop({
<animate
attributeName="opacity"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="1;0"
keySplines=".52,.6,.25,.99"
repeatCount="indefinite"