Skip to content

Commit 474447a

Browse files
committed
fix beam animation direction bug
1 parent 0dc9d9a commit 474447a

File tree

3 files changed

+57
-42
lines changed

3 files changed

+57
-42
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "orcfax.io",
3-
"version": "0.0.2",
3+
"version": "2025-05-20",
44
"private": true,
55
"scripts": {
66
"dev": "vite dev",

src/lib/components/AnimatedBeam.svelte

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,48 @@
33
import { onMount, tick } from "svelte";
44
import { motion } from "$lib/actions/motion.svelte";
55
6-
let className: any = "";
7-
export { className as class };
8-
export let containerRef;
9-
export let fromRef;
10-
export let toRef;
11-
export let curvature = 0;
12-
export let reverse = false; // Include the reverse pro;
13-
export let duration = Math.random() * 3 + 4;
14-
export let delay = 0;
15-
export let pathColor = "gray";
16-
export let pathWidth = 2;
17-
export let pathOpacity = 0.2;
18-
export let gradientStartColor = "#A3C7C4";
19-
export let gradientStopColor = "#52817e";
20-
export let startXOffset = 0;
21-
export let startYOffset = 0;
22-
export let endXOffset = 0;
23-
export let endYOffset = 0;
6+
// Props using $props rune
7+
const {
8+
class: className = "",
9+
containerRef = $bindable(),
10+
fromRef = $bindable(),
11+
toRef = $bindable(),
12+
curvature = 0,
13+
reverse = false,
14+
duration = Math.random() * 3 + 4,
15+
delay = 0,
16+
pathColor = "gray",
17+
pathWidth = 2,
18+
pathOpacity = 0.2,
19+
gradientStartColor = "#A3C7C4",
20+
gradientStopColor = "#52817e",
21+
startXOffset = 0,
22+
startYOffset = 0,
23+
endXOffset = 0,
24+
endYOffset = 0,
25+
} = $props();
2426
25-
let id = crypto.randomUUID().slice(0, 8);
26-
let pathD = "";
27-
let svgDimensions = { width: 0, height: 0 };
27+
// State using $state rune
28+
let id = $state(crypto.randomUUID().slice(0, 8));
29+
let pathD = $state("");
30+
let svgDimensions = $state({ width: 0, height: 0 });
2831
29-
// Calculate the gradient coordinates based on the reverse prop
30-
let gradientCoordinates = reverse
31-
? {
32-
x1: ["90%", "-10%"],
33-
x2: ["100%", "0%"],
34-
y1: ["0%", "0%"],
35-
y2: ["0%", "0%"],
36-
}
37-
: {
38-
x1: ["10%", "110%"],
39-
x2: ["0%", "100%"],
40-
y1: ["0%", "0%"],
41-
y2: ["0%", "0%"],
42-
};
32+
// Derived values using $derived rune
33+
const gradientCoordinates = $derived(
34+
reverse
35+
? {
36+
x1: ["90%", "-10%"],
37+
x2: ["100%", "0%"],
38+
y1: ["0%", "0%"],
39+
y2: ["0%", "0%"],
40+
}
41+
: {
42+
x1: ["10%", "110%"],
43+
x2: ["0%", "100%"],
44+
y1: ["0%", "0%"],
45+
y2: ["0%", "0%"],
46+
}
47+
);
4348
4449
let updatePath = () => {
4550
let containerRect = containerRef?.getBoundingClientRect();
@@ -60,6 +65,7 @@
6065
let d = `M ${startX},${startY} Q ${(startX + endX) / 2},${controlY} ${endX},${endY}`;
6166
pathD = d;
6267
};
68+
6369
onMount(async () => {
6470
await tick().then(() => {
6571
updatePath();

src/lib/components/WorkflowAnimation.svelte

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
2020
let size = $derived.by(() => {
2121
if (innerWidth <= 640) return "xs";
22+
else return "lg";
2223
});
2324
2425
// Refs for all circles
@@ -37,8 +38,8 @@
3738
let validate3Ref = $state<HTMLElement | SVGElement>();
3839
// Publish stage
3940
let publish1Ref = $state<HTMLElement | SVGElement>();
40-
let publish2Ref = $state<HTMLElement | SVGElement>();
41-
let publish3Ref = $state<HTMLElement | SVGElement>();
41+
let publishCardanoRef = $state<HTMLElement | SVGElement>();
42+
let publishArweaveRef = $state<HTMLElement | SVGElement>();
4243
4344
let collect1Duration = $derived(size === "xs" ? 8 : 4);
4445
let collect2Duration = $derived(size === "xs" ? 8 : 4);
@@ -144,12 +145,20 @@
144145
</Circle>
145146
<div class="flex flex-row sm:flex-col justify-center gap-2 sm:gap-8">
146147
<Circle class="p-0 h-10 w-10 bg-blue-600">
147-
<div bind:this={publish2Ref} class="tooltip tooltip-left" data-tip={"Cardano"}>
148+
<div
149+
bind:this={publishCardanoRef}
150+
class="tooltip tooltip-left"
151+
data-tip={"Cardano"}
152+
>
148153
<CardanoLogo />
149154
</div>
150155
</Circle>
151156
<Circle class="p-0 h-10 w-10 bg-white">
152-
<div bind:this={publish3Ref} class="tooltip tooltip-left" data-tip={"Arweave"}>
157+
<div
158+
bind:this={publishArweaveRef}
159+
class="tooltip tooltip-left"
160+
data-tip={"Arweave"}
161+
>
153162
<ArweaveLogo />
154163
</div>
155164
</Circle>
@@ -223,15 +232,15 @@
223232
<AnimatedBeam
224233
bind:containerRef
225234
bind:fromRef={publish1Ref}
226-
bind:toRef={publish2Ref}
235+
bind:toRef={publishCardanoRef}
227236
duration={publish1Duration}
228237
delay={4.5}
229238
reverse={size === "xs" ? true : false}
230239
/>
231240
<AnimatedBeam
232241
bind:containerRef
233242
bind:fromRef={publish1Ref}
234-
bind:toRef={publish3Ref}
243+
bind:toRef={publishArweaveRef}
235244
duration={publish1Duration}
236245
delay={4.5}
237246
/>

0 commit comments

Comments
 (0)