From 9dcb26fe5ca184aaf5b23f8a1fce5a79433b98f4 Mon Sep 17 00:00:00 2001 From: mikha Date: Fri, 19 Apr 2024 23:45:36 +0200 Subject: [PATCH] added rotate 2; reworked rotate 1 --- src/loading-animations/RotateOne.svelte | 19 +- src/loading-animations/RotateTwo.svelte | 68 ++++++ src/loading-animations/index.ts | 1 + .../LoadingAnimation.story.svelte | 229 +++++++++++++----- 4 files changed, 252 insertions(+), 65 deletions(-) create mode 100644 src/loading-animations/RotateTwo.svelte diff --git a/src/loading-animations/RotateOne.svelte b/src/loading-animations/RotateOne.svelte index a8347b9..1bd0fcb 100644 --- a/src/loading-animations/RotateOne.svelte +++ b/src/loading-animations/RotateOne.svelte @@ -28,14 +28,25 @@ */ export let length = 25; $: length = Math.max(1, length); + + /** + * Whether the line caps are rounded. + * @default false + */ + export let round = false; + /** + * The offset from the center. + * @default 25 + */ + export let offset = 25; - - {#key count} + + {#key count + length + Number(round)} {#each Array(count) as _, i} @@ -52,7 +63,7 @@ stroke-width: var(--width); stroke: currentcolor; transform-origin: center; - transform: rotate(var(--angle)) translate(50%, 50%); + transform: rotate(var(--angle)); animation: fade var(--speed) var(--delay) linear infinite; } @keyframes fade { diff --git a/src/loading-animations/RotateTwo.svelte b/src/loading-animations/RotateTwo.svelte new file mode 100644 index 0000000..6bd8eea --- /dev/null +++ b/src/loading-animations/RotateTwo.svelte @@ -0,0 +1,68 @@ + + + + + {#key count + radius + speed} + {#each Array(count) as _, i} + + {/each} + {/key} + + + + diff --git a/src/loading-animations/index.ts b/src/loading-animations/index.ts index 8177001..1d55ef2 100644 --- a/src/loading-animations/index.ts +++ b/src/loading-animations/index.ts @@ -12,6 +12,7 @@ export { default as Heart } from "./Heart.svelte"; export { default as Hourglass } from "./Hourglass.svelte"; export { default as HeartOutline } from "./HeartOutline.svelte"; export { default as RotateOne } from "./RotateOne.svelte"; +export { default as RotateTwo } from "./RotateTwo.svelte"; export { default as Clock } from "./Clock.svelte"; export { default as BlockWave } from "./BlockWave.svelte"; export { default as BlockShuffle } from "./BlockShuffle.svelte"; diff --git a/src/stories/components/Loading Animations/LoadingAnimation.story.svelte b/src/stories/components/Loading Animations/LoadingAnimation.story.svelte index 8b1d100..60e1d23 100644 --- a/src/stories/components/Loading Animations/LoadingAnimation.story.svelte +++ b/src/stories/components/Loading Animations/LoadingAnimation.story.svelte @@ -5,20 +5,20 @@ export let Hst: Hst; - let spin_speed = 3; + let spin_duration = 3; let spin_scale = 0.25; let spin_border_width = 0; - let shrink_speed = 2; + let shrink_duration = 2; let shrink_reverse = false; - let grow_speed = 2; + let grow_duration = 2; let grow_reverse = false; - let slide_speed = 4; + let slide_duration = 4; let slide_reverse = false; - let oscillate_speed = 2; + let oscillate_duration = 2; let oscillate_count = 5; let oscillate_width = 50; let oscillate_bar_width = 6; @@ -27,54 +27,61 @@ let spinCircles_merge = 0.9; let spinCircles_r = 10; let spinCircles_r2 = 15; - let spinCircles_speed = 1; + let spinCircles_duration = 1; let spinCircles_reverse = false; - let spinGlass_speed = 1; + let spinGlass_duration = 1; let spinGlass_rotations = 3; let spinGlass_reverse = false; - let dualBalls_speed = 1; + let dualBalls_duration = 1; let dualBalls_reverse = false; let dna_count = 10; let dna_r = 4; let dna_r2 = 2; let dna_height = 36; - let dna_speed = 1; + let dna_duration = 1; let pie_count = 8; - let pie_speed = 1; + let pie_duration = 1; let pie_scale = 0.5; let pie_reverse = false; - let heart_speed = 1.5; + let heart_duration = 1.5; - let heartOutline_speed = 2; + let heartOutline_duration = 2; let heartOutline_reverse = false; - let hourglass_speed = 1; + let hourglass_duration = 1; - let rotateOne_speed = 1; - let rotateOne_count = 12; + let rotateOne_duration = 1; + let rotateOne_count = 10; let rotateOne_width = 10; let rotateOne_length = 25; + let rotateOne_offset = 25; + let rotateOne_round = false; - let clock_speed = 1; + let rotateTwo_duration = 1; + let rotateTwo_count = 10; + let rotateTwo_radius = 10; + let rotateTwo_offset = 35; - let blockWave_speed = 2; + let clock_duration = 1; + + let blockWave_duration = 2; let blockWave_count = 4; - let blockShuffle_speed = 2; + let blockShuffle_duration = 2; let blockShuffle_count = 3; let blockShuffle_br = 10; - let dotSlide_speed = 0.5; + let dotSlide_duration = 0.5; let dotSlide_r = 15; let dotSlide_reverse = false; let dotSpin_count = 2; - let dotSpin_speed = 1; + let dotSpin_duration = 1; let dotSpin_reverse = false; let dotSpin_r = 15; @@ -83,13 +90,13 @@ - + @@ -101,20 +108,20 @@ bind:r={dna_r} bind:r2={dna_r2} bind:height={dna_height} - bind:speed={dna_speed} + bind:speed={dna_duration} /> - + @@ -122,77 +129,141 @@ - + - + - + - + - + + + + + + + + + + + + + - + - + - + - + - + - + - + @@ -200,19 +271,25 @@ - + - + - + - + - + - + - + - + @@ -283,11 +378,11 @@ - + @@ -296,13 +391,19 @@ - + @@ -310,12 +411,18 @@ - +