fix: quiet sparks instead of dashed rings around the automation panel
The pulsing dashed rings around the example workflow read as a second, broken frame. The panel now sheds a few digits at its left edge like the other frames on light backgrounds, and the ring motion, which nothing else used, is removed from BitAura. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,8 +4,8 @@ import * as React from "react";
|
|||||||
|
|
||||||
type AuraSource = "top" | "right" | "bottom" | "left" | "around";
|
type AuraSource = "top" | "right" | "bottom" | "left" | "around";
|
||||||
type AuraTone = "dark" | "light";
|
type AuraTone = "dark" | "light";
|
||||||
/** How the energy behaves: `sparks` drift off the edge, `rain` falls onto it, `pulse` sends rings outward. */
|
/** How the energy behaves: `sparks` drift off the edge, `rain` falls onto it. */
|
||||||
type AuraMotion = "sparks" | "rain" | "pulse";
|
type AuraMotion = "sparks" | "rain";
|
||||||
|
|
||||||
interface BitAuraProps {
|
interface BitAuraProps {
|
||||||
/** The edge the energy sits on, or `around` to let it travel round the element. */
|
/** The edge the energy sits on, or `around` to let it travel round the element. */
|
||||||
@@ -53,8 +53,6 @@ interface Palette {
|
|||||||
core: string;
|
core: string;
|
||||||
digit: string;
|
digit: string;
|
||||||
gain: number;
|
gain: number;
|
||||||
/** Opacity of the pulse rings at the edge. */
|
|
||||||
ring: number;
|
|
||||||
/** Share of the digit sparks that are kept (1 = all). */
|
/** Share of the digit sparks that are kept (1 = all). */
|
||||||
density: number;
|
density: number;
|
||||||
}
|
}
|
||||||
@@ -86,7 +84,6 @@ const LIGHT_PALETTE: Palette = {
|
|||||||
digit: "15, 23, 42",
|
digit: "15, 23, 42",
|
||||||
// No haze on light backgrounds: coloured light only reads on dark. Ink digits only.
|
// No haze on light backgrounds: coloured light only reads on dark. Ink digits only.
|
||||||
gain: 0,
|
gain: 0,
|
||||||
ring: 0.45,
|
|
||||||
density: 0.6,
|
density: 0.6,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -96,21 +93,16 @@ const DARK_PALETTE: Palette = {
|
|||||||
core: "224, 231, 255",
|
core: "224, 231, 255",
|
||||||
digit: "199, 210, 254",
|
digit: "199, 210, 254",
|
||||||
gain: 1,
|
gain: 1,
|
||||||
ring: 0.8,
|
|
||||||
density: 1,
|
density: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
const MOTION_DENSITY: Record<AuraMotion, number> = {
|
const MOTION_DENSITY: Record<AuraMotion, number> = {
|
||||||
sparks: 0.45,
|
sparks: 0.45,
|
||||||
rain: 0.3,
|
rain: 0.3,
|
||||||
pulse: 0.2,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const PULSE_RINGS = 3;
|
|
||||||
const PULSE_PERIOD_S = 4.2;
|
|
||||||
/** How often a drifting digit switches between 0 and 1. */
|
/** How often a drifting digit switches between 0 and 1. */
|
||||||
const FLIPS_PER_S = 0.9;
|
const FLIPS_PER_S = 0.9;
|
||||||
const PULSE_REACH = 56;
|
|
||||||
|
|
||||||
const fraction = (value: number) => value - Math.floor(value);
|
const fraction = (value: number) => value - Math.floor(value);
|
||||||
|
|
||||||
@@ -150,12 +142,6 @@ const spotsAt = (
|
|||||||
t: number,
|
t: number,
|
||||||
box: Box,
|
box: Box,
|
||||||
): readonly Spot[] => {
|
): readonly Spot[] => {
|
||||||
if (motion === "pulse") {
|
|
||||||
return [0, 1, 2, 3].map((corner) => ({
|
|
||||||
at: (corner + 0.5) / 4,
|
|
||||||
power: 0.45 + 0.25 * Math.sin(t * 0.8 - corner * 1.57),
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (source === "around") {
|
if (source === "around") {
|
||||||
return [
|
return [
|
||||||
{ at: fraction(t * 0.03), power: 1 },
|
{ at: fraction(t * 0.03), power: 1 },
|
||||||
@@ -327,26 +313,6 @@ export const BitAura: React.FC<BitAuraProps> = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (motion === "pulse") {
|
|
||||||
context.setLineDash([3, 7]);
|
|
||||||
context.lineWidth = 1.5;
|
|
||||||
for (let ring = 0; ring < PULSE_RINGS; ring++) {
|
|
||||||
const phase = fraction(clock / PULSE_PERIOD_S + ring / PULSE_RINGS);
|
|
||||||
const grow = phase * PULSE_REACH;
|
|
||||||
context.strokeStyle = `rgba(${palette.core}, ${(1 - phase) ** 2 * palette.ring})`;
|
|
||||||
context.beginPath();
|
|
||||||
context.roundRect(
|
|
||||||
-grow,
|
|
||||||
-grow,
|
|
||||||
box.width + 2 * grow,
|
|
||||||
box.height + 2 * grow,
|
|
||||||
radius + grow,
|
|
||||||
);
|
|
||||||
context.stroke();
|
|
||||||
}
|
|
||||||
context.setLineDash([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.fillStyle = `rgb(${palette.digit})`;
|
context.fillStyle = `rgb(${palette.digit})`;
|
||||||
context.textAlign = "center";
|
context.textAlign = "center";
|
||||||
context.textBaseline = "middle";
|
context.textBaseline = "middle";
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ export const AutomationFlow: React.FC = () => {
|
|||||||
{flow.summary}
|
{flow.summary}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<BitAura source="around" tone="light" motion="pulse" className="mt-8">
|
<BitAura source="left" tone="light" className="mt-8">
|
||||||
<div className="overflow-hidden rounded-3xl bg-slate-900">
|
<div className="overflow-hidden rounded-3xl bg-slate-900">
|
||||||
<div className="flex items-center justify-between border-b border-slate-800 px-5 py-4 md:px-7">
|
<div className="flex items-center justify-between border-b border-slate-800 px-5 py-4 md:px-7">
|
||||||
<span className={`${MONO} text-slate-400`}>{flow.name}</span>
|
<span className={`${MONO} text-slate-400`}>{flow.name}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user