Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

5.4 KB
Raw Blame
/******************************************************************************
 * ui-juice.css — shared classes for the game-feel library (src/ui-juice.js).
 * ════════════════════════════════════════════════════════════════════════════
 * Every animation is driven by the motion tokens in public/tokens.css
 * (--duration-* / --ease-*). Because that file zeroes --duration-* under
 * `@media (prefers-reduced-motion: reduce)`, the keyframe-driven animations
 * below collapse to their final frame automatically — no extra reduced-motion
 * block is needed for token-driven durations. A belt-and-braces reduce block at
 * the bottom also disables the few effects that can't reference a duration var.
 *
 * Class names mirror exactly what src/ui-juice.js emits (the `juice-*`
 * namespace); keep the two files in lockstep.
 *****************************************************************************/

/* ── flashValue: directional tint pulse ─────────────────────────────────── */
.juice-flash--up { animation: juice-flash-up var(--duration-slow) var(--ease-out); }
.juice-flash--down { animation: juice-flash-down var(--duration-slow) var(--ease-out); }
.juice-flash--neutral { animation: juice-flash-neutral var(--duration-slow) var(--ease-out); }

@keyframes juice-flash-up {
	from { background-color: rgba(74, 222, 128, 0.22); }
	to { background-color: transparent; }
}
@keyframes juice-flash-down {
	from { background-color: rgba(248, 113, 113, 0.22); }
	to { background-color: transparent; }
}
@keyframes juice-flash-neutral {
	from { background-color: var(--surface-3); }
	to { background-color: transparent; }
}

/* ── enterRow / enterStagger: newly-landed feed item ────────────────────── */
.juice-enter {
	animation: juice-enter var(--duration-base) var(--ease-emphasized);
	animation-delay: var(--juice-enter-delay, 0ms);
	animation-fill-mode: both;
}
@keyframes juice-enter {
	from { opacity: 0; transform: translateY(-10px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ── sparkline ──────────────────────────────────────────────────────────── */
.juice-spark { display: block; overflow: visible; }
/* Animated draw: the modifier rides the <svg>; the stroke lives on the <polyline>. */
.juice-spark--draw polyline {
	stroke-dasharray: 1000;
	stroke-dashoffset: 1000;
	animation: juice-spark-draw var(--duration-slow) var(--ease-out) forwards;
}
@keyframes juice-spark-draw { to { stroke-dashoffset: 0; } }

/* ── ring gauge ─────────────────────────────────────────────────────────── */
.juice-ring { display: block; }
/* playRings() sweeps stroke-dashoffset from full (empty) to the real offset. */
.juice-ring-fill { transition: stroke-dashoffset var(--duration-base) var(--ease-emphasized); }
.juice-ring-label {
	fill: var(--ink-bright);
	font-family: var(--font-mono);
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
}

/* ── liveDot: SSE connection vocabulary ─────────────────────────────────── */
.juice-live {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2xs);
	font-size: var(--text-2xs);
	color: var(--ink-faint);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.juice-live-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ink-faint);
	transition: background var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
.juice-live[data-state='connecting'] { color: var(--warn); }
.juice-live[data-state='connecting'] .juice-live-dot {
	background: var(--warn);
	animation: juice-live-pulse 1.2s var(--ease-standard) infinite;
}
.juice-live[data-state='live'] { color: var(--success); }
.juice-live[data-state='live'] .juice-live-dot {
	background: var(--success);
	box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}
.juice-live[data-state='error'] { color: var(--danger); }
.juice-live[data-state='error'] .juice-live-dot { background: var(--danger); }
@keyframes juice-live-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.35; }
}

/* ── rippleOnce: single "it shipped" accent sweep ───────────────────────── */
.juice-ripple { position: relative; overflow: hidden; }
.juice-ripple::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
	transform: translateX(-100%);
	animation: juice-ripple var(--duration-slow) var(--ease-out);
}
@keyframes juice-ripple {
	from { transform: translateX(-100%); }
	to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
	.juice-flash--up,
	.juice-flash--down,
	.juice-flash--neutral,
	.juice-enter,
	.juice-spark--draw polyline,
	.juice-ripple::after,
	.juice-live[data-state='connecting'] .juice-live-dot {
		animation: none;
	}
	.juice-spark--draw polyline { stroke-dashoffset: 0; }
	.juice-ripple::after { display: none; }
}