Motion FX
JS behaviour
Animated beams
A living architecture map: service nodes on an SVG canvas with beam-like lines pulsing between them through animated stroke-dash — light that travels and fades; hovering a node brightens and quickens just its beams, so the wiring explains itself.
Real scenarios
The component as it is used in a product — not a specimen grid.
How Lumen Platform talks to itself
Five services around one orchestrator. The faint lines are the wiring; the moving light is traffic. Rest on a node and only its beams brighten and quicken.
Chips do the same job for touch and keyboard — every node is focusable and announces itself.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| stroke-dasharray | length | '16 210' | The light segment’s length and the gap before it repeats; smaller means shorter, sparser comets. |
| --mfxab-duration | time | '3.2s' | One pulse’s travel time end to end; hovered beams run quicker. |
| --mfxab-beam | color | '#6366f1' | The beam colour; each demo defines its gradient under a prefixed id so it never collides with another demo. |
| data-hot | state | '' | Hovering or focusing a node lights the beams wired to it and glows its ring; the chips under the canvas build the same state for touch. |
| prefers-reduced-motion | behaviour | 'freeze' | The pulses freeze and the mesh settles half-lit; hover still changes brightness. |
Snippet
<div class="mfxab" x-data="{ hot: '' }">
<svg class="mfxab-map" viewBox="0 0 640 300" role="img" aria-label="Service map">
<defs>
<linearGradient id="mfxab-glow" x1="0" x2="1">
<stop offset="0" stop-color="#6366f1" stop-opacity="0" />
<stop offset="1" stop-color="#22d3ee" />
</linearGradient>
</defs>
<path class="mfxab-wire" d="M320 150 Q 200 90 110 80" />
<path class="mfxab-beam" stroke="url(#mfxab-glow)" d="M320 150 Q 200 90 110 80"
x-bind:data-hot="hot === 'web' || hot === 'hub'" />
<g class="mfxab-node" x-bind:data-hot="hot === 'web'" @pointerenter="hot = 'web'" @pointerleave="hot = ''">
<circle cx="110" cy="80" r="30" /><text y="130">Web app</text>
</g>
</svg>
</div>
<style>
.mfxab-wire { fill: none; stroke: #cbd5e1; stroke-width: 1.5; }
.mfxab-beam { fill: none; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 16 210;
animation: mfxab-run 3.2s linear infinite; opacity: .75; }
.mfxab-beam[data-hot] { opacity: 1; stroke-width: 3; }
@keyframes mfxab-run { to { stroke-dashoffset: -226; } }
</style>
// app/Pages/Architecture.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import BeamMap from '@/components/BeamMap';
export default function Architecture() {
return (
<NabuXUIProvider locale="en" linkComponent={Link}>
<main className="nx-page">
<BeamMap />
</main>
</NabuXUIProvider>
);
}
// BeamMap.jsx — service nodes wired by pulsing stroke-dash beams
import { useState } from 'react';
import '@nabuxai/ui-core/css';
const HUB = { id: 'hub', label: 'Orchestrator', x: 320, y: 150 };
const NODES = [
{ id: 'web', label: 'Web app', city: 'Dublin', x: 110, y: 70 },
{ id: 'auth', label: 'Auth', city: 'Frankfurt', x: 320, y: 40 },
{ id: 'search', label: 'Search', city: 'Singapore', x: 530, y: 70 },
{ id: 'media', label: 'Media', city: 'Osaka', x: 530, y: 240 },
{ id: 'queue', label: 'Queue', city: 'Toronto', x: 110, y: 240 },
];
const beam = (a, b) => `M${a.x} ${a.y} Q ${(a.x + b.x) / 2} ${(a.y + b.y) / 2 - 60} ${b.x} ${b.y}`;
export default function BeamMap() {
const [hot, setHot] = useState('');
const lit = (id) => hot === id || hot === 'hub';
return (
<>
<style>{`
.mfxab-map { inline-size: 100%; max-inline-size: 40rem; }
.mfxab-wire { fill: none; stroke: #cbd5e1; stroke-width: 1.5; }
.mfxab-beam { fill: none; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 16 210;
animation: mfxab-run 3.2s linear infinite; opacity: .7;
transition: opacity .2s, stroke-width .2s; }
.mfxab-beam[data-hot] { opacity: 1; stroke-width: 3.5; animation-duration: 1.6s; }
.mfxab-node circle { fill: #fff; stroke: #cbd5e1; stroke-width: 1.5; transition: stroke .2s; }
.mfxab-node[data-hot] circle { stroke: #6366f1; stroke-width: 3; }
.mfxab-node text { text-anchor: middle; font: 600 15px system-ui; fill: #16181d; }
.mfxab-node[data-hot] text { fill: #6366f1; }
@keyframes mfxab-run { to { stroke-dashoffset: -226; } }
@media (prefers-reduced-motion: reduce) { .mfxab-beam { animation: none; opacity: .5; } }
`}</style>
<svg className="mfxab-map" viewBox="0 0 640 300" role="img" aria-label="Service map">
<defs>
<linearGradient id="mfxab-glow" x1="0" x2="1">
<stop offset="0" stopColor="#6366f1" stopOpacity="0" />
<stop offset="1" stopColor="#22d3ee" />
</linearGradient>
</defs>
{NODES.map((n) => (
<g key={n.id}>
<path className="mfxab-wire" d={beam(HUB, n)} />
<path className="mfxab-beam" stroke="url(#mfxab-glow)" d={beam(HUB, n)}
data-hot={lit(n.id) || undefined} />
</g>
))}
<g className="mfxab-node" data-hot={hot === 'hub' || undefined}
onPointerEnter={() => setHot('hub')} onPointerLeave={() => setHot('')}>
<circle cx={HUB.x} cy={HUB.y} r="34" /><text x={HUB.x} y={HUB.y + 5}>Hub</text>
</g>
{NODES.map((n) => (
<g key={n.id} className="mfxab-node" data-hot={hot === n.id || undefined}
onPointerEnter={() => setHot(n.id)} onPointerLeave={() => setHot('')}>
<circle cx={n.x} cy={n.y} r="28" /><text x={n.x} y={n.y + 5}>{n.label}</text>
</g>
))}
</svg>
</>
);
}
<!-- BeamMap.vue — service nodes wired by pulsing stroke-dash beams -->
<script setup lang="ts">
import { ref } from 'vue';
import '@nabuxai/ui-core/css';
const hub = { id: 'hub', label: 'Orchestrator', x: 320, y: 150 };
const nodes = [
{ id: 'web', label: 'Web app', city: 'Dublin', x: 110, y: 70 },
{ id: 'auth', label: 'Auth', city: 'Frankfurt', x: 320, y: 40 },
{ id: 'search', label: 'Search', city: 'Singapore', x: 530, y: 70 },
{ id: 'media', label: 'Media', city: 'Osaka', x: 530, y: 240 },
{ id: 'queue', label: 'Queue', city: 'Toronto', x: 110, y: 240 },
];
const hot = ref('');
const lit = (id: string) => hot.value === id || hot.value === 'hub';
const beam = (a: { x: number; y: number }, b: { x: number; y: number }) =>
`M${a.x} ${a.y} Q ${(a.x + b.x) / 2} ${(a.y + b.y) / 2 - 60} ${b.x} ${b.y}`;
</script>
<template>
<svg class="mfxab-map" viewBox="0 0 640 300" role="img" aria-label="Service map">
<defs>
<linearGradient id="mfxab-glow" x1="0" x2="1">
<stop offset="0" stop-color="#6366f1" stop-opacity="0" />
<stop offset="1" stop-color="#22d3ee" />
</linearGradient>
</defs>
<g v-for="n in nodes" :key="n.id">
<path class="mfxab-wire" :d="beam(hub, n)" />
<path class="mfxab-beam" stroke="url(#mfxab-glow)" :d="beam(hub, n)" :data-hot="lit(n.id) || undefined" />
</g>
<g class="mfxab-node" :data-hot="hot === 'hub' || undefined"
@pointerenter="hot = 'hub'" @pointerleave="hot = ''">
<circle :cx="hub.x" :cy="hub.y" r="34" /><text :x="hub.x" :y="hub.y + 5">Hub</text>
</g>
<g v-for="n in nodes" :key="n.id" class="mfxab-node" :data-hot="hot === n.id || undefined"
@pointerenter="hot = n.id" @pointerleave="hot = ''">
<circle :cx="n.x" :cy="n.y" r="28" /><text :x="n.x" :y="n.y + 5">{{ n.label }}</text>
</g>
</svg>
</template>
<style scoped>
.mfxab-map { inline-size: 100%; max-inline-size: 40rem; }
.mfxab-wire { fill: none; stroke: #cbd5e1; stroke-width: 1.5; }
.mfxab-beam { fill: none; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 16 210;
animation: mfxab-run 3.2s linear infinite; opacity: .7;
transition: opacity .2s, stroke-width .2s; }
.mfxab-beam[data-hot] { opacity: 1; stroke-width: 3.5; animation-duration: 1.6s; }
.mfxab-node :deep(circle) { fill: #fff; stroke: #cbd5e1; stroke-width: 1.5; transition: stroke .2s; }
.mfxab-node[data-hot] :deep(circle) { stroke: #6366f1; stroke-width: 3; }
.mfxab-node :deep(text) { text-anchor: middle; font: 600 15px system-ui; fill: #16181d; }
.mfxab-node[data-hot] :deep(text) { fill: #6366f1; }
@keyframes mfxab-run { to { stroke-dashoffset: -226; } }
@media (prefers-reduced-motion: reduce) { .mfxab-beam { animation: none; opacity: .5; } }
</style>
<!-- BeamMap.svelte — service nodes wired by pulsing stroke-dash beams -->
<script lang="ts">
import '@nabuxai/ui-core/css';
const hub = { id: 'hub', label: 'Orchestrator', x: 320, y: 150 };
const nodes = [
{ id: 'web', label: 'Web app', city: 'Dublin', x: 110, y: 70 },
{ id: 'auth', label: 'Auth', city: 'Frankfurt', x: 320, y: 40 },
{ id: 'search', label: 'Search', city: 'Singapore', x: 530, y: 70 },
{ id: 'media', label: 'Media', city: 'Osaka', x: 530, y: 240 },
{ id: 'queue', label: 'Queue', city: 'Toronto', x: 110, y: 240 },
];
let hot = $state('');
const lit = (id: string) => hot === id || hot === 'hub';
const beam = (a: { x: number; y: number }, b: { x: number; y: number }) =>
`M${a.x} ${a.y} Q ${(a.x + b.x) / 2} ${(a.y + b.y) / 2 - 60} ${b.x} ${b.y}`;
</script>
<svg class="mfxab-map" viewBox="0 0 640 300" role="img" aria-label="Service map">
<defs>
<linearGradient id="mfxab-glow" x1="0" x2="1">
<stop offset="0" stop-color="#6366f1" stop-opacity="0" />
<stop offset="1" stop-color="#22d3ee" />
</linearGradient>
</defs>
{#each nodes as n (n.id)}
<path class="mfxab-wire" d={beam(hub, n)} />
<path class="mfxab-beam" stroke="url(#mfxab-glow)" d={beam(hub, n)} data-hot={lit(n.id) || undefined} />
{/each}
<g class="mfxab-node" data-hot={hot === 'hub' || undefined}
onpointerenter={() => (hot = 'hub')} onpointerleave={() => (hot = '')}>
<circle cx={hub.x} cy={hub.y} r="34" /><text x={hub.x} y={hub.y + 5}>Hub</text>
</g>
{#each nodes as n (n.id)}
<g class="mfxab-node" data-hot={hot === n.id || undefined}
onpointerenter={() => (hot = n.id)} onpointerleave={() => (hot = '')}>
<circle cx={n.x} cy={n.y} r="28" /><text x={n.x} y={n.y + 5}>{n.label}</text>
</g>
{/each}
</svg>
<style>
.mfxab-map { inline-size: 100%; max-inline-size: 40rem; }
.mfxab-wire { fill: none; stroke: #cbd5e1; stroke-width: 1.5; }
.mfxab-beam { fill: none; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 16 210;
animation: mfxab-run 3.2s linear infinite; opacity: .7;
transition: opacity .2s, stroke-width .2s; }
.mfxab-beam[data-hot] { opacity: 1; stroke-width: 3.5; animation-duration: 1.6s; }
.mfxab-node circle { fill: #fff; stroke: #cbd5e1; stroke-width: 1.5; transition: stroke .2s; }
.mfxab-node[data-hot] circle { stroke: #6366f1; stroke-width: 3; }
.mfxab-node text { text-anchor: middle; font: 600 15px system-ui; fill: #16181d; }
.mfxab-node[data-hot] text { fill: #6366f1; }
@keyframes mfxab-run { to { stroke-dashoffset: -226; } }
@media (prefers-reduced-motion: reduce) { .mfxab-beam { animation: none; opacity: .5; } }
</style>