claude-exode-mcp 7.5.7 → 7.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MCP_DOCUMENTATION.md +1 -0
- package/SKILL.md +10 -0
- package/examples/aurum-product-page.exode +3208 -0
- package/examples/bell-ring-icon.exode +1 -0
- package/examples/drift-kinetic-type.exode +770 -0
- package/examples/earbuds-product.exode +214 -0
- package/examples/energy-flow.exode +1736 -0
- package/examples/flux-hero.exode +223 -0
- package/examples/gooey-toggle.exode +214 -0
- package/examples/gravity-well.exode +3113 -0
- package/examples/heart-icon.exode +1 -0
- package/examples/hologram-temple.exode +8100 -0
- package/examples/jarful-app.exode +1 -0
- package/examples/kip-character-rig.exode +1 -0
- package/examples/low-tide-tilt.exode +2216 -0
- package/examples/manifest.json +352 -0
- package/examples/swipe-stack-carousel.exode +4048 -0
- package/examples/tokyo-neon-weather.exode +470 -0
- package/examples/typographic-collapse.exode +1578 -0
- package/examples/void-product-ad.exode +1269 -0
- package/examples/wire-globe-card.exode +580 -0
- package/index.d.ts +41 -1
- package/index.js +2553 -2407
- package/package.json +4 -2
- package/render-runtime/exode-runtime.js +20 -20
- package/skills/creative-motion/SKILL.md +10 -0
- package/skills/creative-motion/recipes/character-rig.js +104 -0
- package/skills/creative-motion/recipes/dashboard.js +120 -0
- package/skills/creative-motion/recipes/game-arcade.js +203 -0
- package/skills/creative-motion/recipes/hero-physics.js +65 -0
- package/skills/creative-motion/recipes/pricing.js +88 -0
- package/skills/creative-motion/recipes/title-sequence.js +62 -0
- package/skills/creative-motion/references/apps.md +37 -0
- package/skills/creative-motion/references/gotchas.md +80 -0
- package/skills/creative-motion/references/native-layers.md +60 -0
- package/skills/creative-motion/references/quality.md +54 -0
- package/src/__tests__/buildKit.test.ts +127 -0
- package/src/__tests__/effectKnobs.test.ts +162 -0
- package/src/__tests__/nativeLayers.test.ts +178 -0
- package/src/buildKit.d.ts +301 -0
- package/src/buildKit.d.ts.map +1 -0
- package/src/buildKit.js +559 -0
- package/src/buildKit.js.map +1 -0
- package/src/buildKit.ts +520 -0
- package/src/compiler.d.ts +4 -0
- package/src/compiler.d.ts.map +1 -1
- package/src/compiler.js +21 -45
- package/src/compiler.js.map +1 -1
- package/src/compiler.ts +22 -51
- package/src/critique.d.ts +8 -0
- package/src/critique.d.ts.map +1 -0
- package/src/critique.js +348 -0
- package/src/critique.js.map +1 -0
- package/src/critique.ts +239 -0
- package/src/effectKnobs.d.ts +72 -0
- package/src/effectKnobs.d.ts.map +1 -0
- package/src/effectKnobs.js +541 -0
- package/src/effectKnobs.js.map +1 -0
- package/src/effectKnobs.ts +445 -0
- package/src/effectOptimizer.d.ts +18 -0
- package/src/effectOptimizer.d.ts.map +1 -0
- package/src/effectOptimizer.js +125 -0
- package/src/effectOptimizer.js.map +1 -0
- package/src/effectOptimizer.ts +104 -0
- package/src/engine/layout.js +1 -1
- package/src/engine/layout.js.map +1 -1
- package/src/engine/layout.ts +1 -1
- package/src/examples.d.ts +30 -0
- package/src/examples.d.ts.map +1 -0
- package/src/examples.js +168 -0
- package/src/examples.js.map +1 -0
- package/src/examples.ts +151 -0
- package/src/handlers/artboardHandlers.d.ts.map +1 -1
- package/src/handlers/artboardHandlers.js +45 -10
- package/src/handlers/artboardHandlers.js.map +1 -1
- package/src/handlers/artboardHandlers.ts +43 -12
- package/src/handlers/buildHandlers.d.ts +2 -0
- package/src/handlers/buildHandlers.d.ts.map +1 -0
- package/src/handlers/buildHandlers.js +86 -0
- package/src/handlers/buildHandlers.js.map +1 -0
- package/src/handlers/buildHandlers.ts +76 -0
- package/src/handlers/compilerHandlers.d.ts.map +1 -1
- package/src/handlers/compilerHandlers.js +32 -2
- package/src/handlers/compilerHandlers.js.map +1 -1
- package/src/handlers/compilerHandlers.ts +31 -2
- package/src/handlers/exampleHandlers.d.ts +2 -0
- package/src/handlers/exampleHandlers.d.ts.map +1 -0
- package/src/handlers/exampleHandlers.js +81 -0
- package/src/handlers/exampleHandlers.js.map +1 -0
- package/src/handlers/exampleHandlers.ts +76 -0
- package/src/handlers/renderHandlers.d.ts.map +1 -1
- package/src/handlers/renderHandlers.js +100 -2
- package/src/handlers/renderHandlers.js.map +1 -1
- package/src/handlers/renderHandlers.ts +90 -2
- package/src/handlers/scaffoldHandlers.d.ts.map +1 -1
- package/src/handlers/scaffoldHandlers.js +3 -0
- package/src/handlers/scaffoldHandlers.js.map +1 -1
- package/src/handlers/scaffoldHandlers.ts +2 -0
- package/src/handlers/widgetHandlers.js +1 -1
- package/src/handlers/widgetHandlers.js.map +1 -1
- package/src/handlers/widgetHandlers.ts +1 -1
- package/src/lottie/convert.d.ts +16 -0
- package/src/lottie/convert.d.ts.map +1 -0
- package/src/lottie/convert.js +1225 -0
- package/src/lottie/convert.js.map +1 -0
- package/src/lottie/convert.ts +1134 -0
- package/src/lottie/evaluate.d.ts +48 -0
- package/src/lottie/evaluate.d.ts.map +1 -0
- package/src/lottie/evaluate.js +174 -0
- package/src/lottie/evaluate.js.map +1 -0
- package/src/lottie/evaluate.ts +184 -0
- package/src/nativeLayers.d.ts +76 -0
- package/src/nativeLayers.d.ts.map +1 -0
- package/src/nativeLayers.js +404 -0
- package/src/nativeLayers.js.map +1 -0
- package/src/nativeLayers.ts +339 -0
- package/src/render/motionBrief.d.ts.map +1 -1
- package/src/render/motionBrief.js +4 -0
- package/src/render/motionBrief.js.map +1 -1
- package/src/render/motionBrief.ts +4 -0
- package/src/render/videoRenderer.d.ts.map +1 -1
- package/src/render/videoRenderer.js +5 -2
- package/src/render/videoRenderer.js.map +1 -1
- package/src/render/videoRenderer.ts +5 -2
- package/src/rive/convert.d.ts +17 -0
- package/src/rive/convert.d.ts.map +1 -0
- package/src/rive/convert.js +1779 -0
- package/src/rive/convert.js.map +1 -0
- package/src/rive/convert.ts +1492 -0
- package/src/rive/font.d.ts +13 -0
- package/src/rive/font.d.ts.map +1 -0
- package/src/rive/font.js +154 -0
- package/src/rive/font.js.map +1 -0
- package/src/rive/font.ts +132 -0
- package/src/rive/layout.d.ts +20 -0
- package/src/rive/layout.d.ts.map +1 -0
- package/src/rive/layout.js +145 -0
- package/src/rive/layout.js.map +1 -0
- package/src/rive/layout.ts +140 -0
- package/src/rive/reader.d.ts +32 -0
- package/src/rive/reader.d.ts.map +1 -0
- package/src/rive/reader.js +172 -0
- package/src/rive/reader.js.map +1 -0
- package/src/rive/reader.ts +160 -0
- package/src/rive/schema.generated.d.ts +9 -0
- package/src/rive/schema.generated.d.ts.map +1 -0
- package/src/rive/schema.generated.js +13 -0
- package/src/rive/schema.generated.js.map +1 -0
- package/src/rive/schema.generated.ts +13 -0
- package/src/schema.d.ts +5 -0
- package/src/schema.d.ts.map +1 -1
- package/src/schema.js +5 -0
- package/src/schema.js.map +1 -1
- package/src/schema.ts +6 -0
- package/src/serverInstructions.d.ts +2 -0
- package/src/serverInstructions.d.ts.map +1 -0
- package/src/serverInstructions.js +22 -0
- package/src/serverInstructions.js.map +1 -0
- package/src/serverInstructions.ts +21 -0
- package/src/sseServer.d.ts +2 -0
- package/src/sseServer.d.ts.map +1 -0
- package/src/sseServer.js +165 -0
- package/src/sseServer.js.map +1 -0
- package/src/sseServer.ts +189 -0
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +23 -1
- package/src/utils.js.map +1 -1
- package/src/utils.ts +13 -1
- package/src/widgets.d.ts +26 -0
- package/src/widgets.d.ts.map +1 -1
- package/src/widgets.js +89 -45
- package/src/widgets.js.map +1 -1
- package/src/widgets.ts +88 -45
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* RECIPE: pricing
|
|
2
|
+
Premium pricing section: heading, a monthly/yearly toggle that really swaps the prices,
|
|
3
|
+
three plan cards with the middle one highlighted, feature lists, CTAs, hover lift and
|
|
4
|
+
press on every card, and a staggered entrance.
|
|
5
|
+
ADAPT: change HEADING, PLANS and PALETTE (any count of features; 2–4 plans fit).
|
|
6
|
+
Run with build_from_script. */
|
|
7
|
+
|
|
8
|
+
const HEADING = { kicker: 'Pricing', title: 'Simple plans that grow with you.', sub: 'Start free for 14 days. No card required, cancel any time.' };
|
|
9
|
+
const PLANS = [
|
|
10
|
+
{ name: 'Starter', blurb: 'For individuals getting going.', monthly: '$12', yearly: '$10', cta: 'Start free trial', features: ['3 projects', 'Unlimited viewers', 'Community support', 'Email reports'] },
|
|
11
|
+
{ name: 'Pro', blurb: 'For growing teams that ship weekly.', monthly: '$29', yearly: '$24', cta: 'Get Pro', badge: 'Most popular', features: ['Unlimited projects', 'Advanced analytics', 'Priority support', 'Custom domains', 'Version history'] },
|
|
12
|
+
{ name: 'Team', blurb: 'For organisations at scale.', monthly: '$59', yearly: '$49', cta: 'Contact sales', features: ['Everything in Pro', 'SSO and SAML', 'Audit logs', 'Dedicated manager'] },
|
|
13
|
+
];
|
|
14
|
+
const HIGHLIGHT = 1; /* index of the featured plan */
|
|
15
|
+
const PALETTE = 'obsidian';
|
|
16
|
+
|
|
17
|
+
const W = 1440, H = 900;
|
|
18
|
+
const P = exode.palette(PALETTE);
|
|
19
|
+
const d = exode.artboard({ name: 'Pricing', width: W, height: H, palette: PALETTE, ease: exode.ease.outQuart });
|
|
20
|
+
d.rect({ name: 'Backdrop', x: W / 2, y: H / 2, w: W, h: H, fill: exode.radial([P.surface, P.bg], [0.5, 0.0], 0.8) });
|
|
21
|
+
d.glow({ name: 'Featured glow', x: W / 2, y: 520, size: 760, color: P.accent, strength: 0.12, scaleY: 0.8 });
|
|
22
|
+
|
|
23
|
+
/* heading */
|
|
24
|
+
const kicker = d.text(HEADING.kicker, { name: 'Kicker', x: W / 2, y: 96, size: 13, weight: 600, color: P.accent, align: 'center', w: 400 });
|
|
25
|
+
const title = d.text(HEADING.title, { name: 'Title', x: W / 2, y: 146, size: 48, weight: 600, color: P.ink, align: 'center', w: 1000 });
|
|
26
|
+
const sub = d.text(HEADING.sub, { name: 'Subtitle', x: W / 2, y: 196, size: 17, color: P.muted, align: 'center', w: 700 });
|
|
27
|
+
|
|
28
|
+
/* billing toggle: a Boolean input drives prices and the knob; clicking it flips the input */
|
|
29
|
+
const yearly = d.input('yearly', 'Boolean', false);
|
|
30
|
+
const tog = d.group({ name: 'Billing toggle', x: W / 2, y: 256, w: 260, h: 40 });
|
|
31
|
+
const track = d.rect({ name: 'Billing toggle / track', parent: tog, x: 0, y: 0, w: 220, h: 40, r: 20, fill: P.raised, stroke: P.line, strokeWidth: 1 });
|
|
32
|
+
const knob = d.rect({ name: 'Billing toggle / knob', parent: tog, x: -55, y: 0, w: 106, h: 32, r: 16, fill: P.ink });
|
|
33
|
+
const tM = d.text('Monthly', { name: 'Billing toggle / monthly', parent: tog, x: -55, y: 0, size: 13, weight: 600, color: P.bg, align: 'center', w: 106 });
|
|
34
|
+
const tY = d.text('Yearly', { name: 'Billing toggle / yearly', parent: tog, x: 55, y: 0, size: 13, weight: 600, color: P.muted, align: 'center', w: 106 });
|
|
35
|
+
d.text('Save 20%', { name: 'Billing toggle / save', parent: tog, x: 170, y: 0, size: 12, weight: 600, color: P.accent, align: 'left', w: 80 });
|
|
36
|
+
track.interactions.push({ id: 'int_toggle', event: 'onClick', trigger: 'onClick', triggers: ['onClick', 'Click'], action: 'Toggle Boolean', targetInputId: yearly });
|
|
37
|
+
|
|
38
|
+
/* cards */
|
|
39
|
+
const cw = 340, ch = 470, gap = 28, x0 = W / 2 - (PLANS.length - 1) * (cw + gap) / 2, cy = 560;
|
|
40
|
+
const priceTexts = [], wrappers = [];
|
|
41
|
+
PLANS.forEach((plan, i) => {
|
|
42
|
+
const hot = i === HIGHLIGHT, left = -cw / 2 + 32;
|
|
43
|
+
const wrap = d.group({ name: `Card ${plan.name}`, x: x0 + i * (cw + gap), y: cy, w: cw, h: ch });
|
|
44
|
+
wrappers.push(wrap);
|
|
45
|
+
const card = d.rect({ name: `Card ${plan.name} / surface`, parent: wrap, x: 0, y: 0, w: cw, h: ch, r: 22, fill: hot ? P.raised : P.surface, stroke: hot ? P.accent : P.line, strokeWidth: hot ? 1.5 : 1, shadow: { blur: hot ? 40 : 24, offsetY: 18, opacity: hot ? 45 : 30 } });
|
|
46
|
+
const top = -ch / 2;
|
|
47
|
+
d.text(plan.name, { name: `Card ${plan.name} / name`, parent: card, left, y: top + 44, size: 18, weight: 600, color: P.ink, w: 200 });
|
|
48
|
+
if (plan.badge) {
|
|
49
|
+
const b = d.rect({ name: `Card ${plan.name} / badge`, parent: card, x: cw / 2 - 32 - 56, y: top + 44, w: 112, h: 26, r: 13, fill: P.accent });
|
|
50
|
+
d.text(plan.badge, { name: `Card ${plan.name} / badge label`, parent: b, x: 0, y: 0, size: 11, weight: 700, color: P.onAccent, align: 'center', w: 112 });
|
|
51
|
+
}
|
|
52
|
+
d.text(plan.blurb, { name: `Card ${plan.name} / blurb`, parent: card, left, y: top + 76, size: 14, color: P.muted, w: cw - 64 });
|
|
53
|
+
const price = d.text(plan.monthly, { name: `Card ${plan.name} / price`, parent: card, left, y: top + 134, size: 48, weight: 600, color: P.ink, w: 140 });
|
|
54
|
+
priceTexts.push([price, plan]);
|
|
55
|
+
d.text('per seat / month', { name: `Card ${plan.name} / period`, parent: card, left: left + 130, y: top + 144, size: 13, color: P.muted, w: 160 });
|
|
56
|
+
d.button(plan.cta, { name: `Card ${plan.name} / CTA button`, parent: card, x: 0, y: top + 204, w: cw - 64, h: 46, radius: 12, size: 14,
|
|
57
|
+
variant: hot ? 'primary' : 'secondary', fill: hot ? P.accent : P.ink, color: hot ? P.onAccent : P.ink, line: P.line, onTap: `choose${plan.name}` });
|
|
58
|
+
d.rect({ name: `Card ${plan.name} / divider`, parent: card, x: 0, y: top + 250, w: cw - 64, h: 1, fill: P.line });
|
|
59
|
+
plan.features.forEach((f, k) => {
|
|
60
|
+
d.path('M-5 0 L-1.5 3.5 L5 -3.5', { name: `Card ${plan.name} / check ${k + 1}`, parent: card, x: left + 6, y: top + 284 + k * 32, w: 12, h: 9, stroke: P.accent, strokeWidth: 2 });
|
|
61
|
+
d.text(f, { name: `Card ${plan.name} / feature ${k + 1}`, parent: card, left: left + 24, y: top + 284 + k * 32, size: 14, color: hot ? P.ink : P.muted, w: cw - 90 });
|
|
62
|
+
});
|
|
63
|
+
d.interactive(card, { lift: 6, scale: 1.015, press: 0.985, shadowBlur: [hot ? 40 : 24, hot ? 56 : 40] });
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/* billing states: prices, knob and labels swap together (one layer owns them) */
|
|
67
|
+
const swap = (toYearly) => {
|
|
68
|
+
const dur = 0.35, e = exode.ease.outBack;
|
|
69
|
+
return [
|
|
70
|
+
d.track(knob, 'x', [[0, toYearly ? -55 : 55, e], [dur, toYearly ? 55 : -55]]),
|
|
71
|
+
d.track(tM, 'fill', [[0, toYearly ? P.bg : P.muted], [dur * 0.5, toYearly ? P.muted : P.bg]]),
|
|
72
|
+
d.track(tY, 'fill', [[0, toYearly ? P.muted : P.bg], [dur * 0.5, toYearly ? P.bg : P.muted]]),
|
|
73
|
+
...priceTexts.flatMap(([t, plan]) => [
|
|
74
|
+
d.track(t, 'text', [[0, toYearly ? plan.monthly : plan.yearly, 'linear'], [0.149, toYearly ? plan.monthly : plan.yearly, 'linear'], [0.15, toYearly ? plan.yearly : plan.monthly]]),
|
|
75
|
+
d.track(t, 'opacity', [[0, 1], [0.15, 0.2], [dur, 1]]),
|
|
76
|
+
]),
|
|
77
|
+
];
|
|
78
|
+
};
|
|
79
|
+
const toY = d.anim('Billing → yearly', swap(true)), toM = d.anim('Billing → monthly', swap(false));
|
|
80
|
+
d.layer('Billing', [
|
|
81
|
+
{ name: 'Monthly', on: { yearly: { to: 'Yearly', op: 'IsTrue', value: true } } },
|
|
82
|
+
{ name: 'Yearly', anim: toY, on: { yearly: { to: 'Back to monthly', op: 'IsFalse', value: false } } },
|
|
83
|
+
{ name: 'Back to monthly', anim: toM, on: { yearly: { to: 'Yearly', op: 'IsTrue', value: true } } },
|
|
84
|
+
]);
|
|
85
|
+
|
|
86
|
+
/* entrance on the wrappers (the cards' own y/scale belong to their hover layer) */
|
|
87
|
+
d.intro(d.reveal([kicker, title, sub, tog, ...wrappers], { dy: 30, step: 0.07, duration: 0.9 }));
|
|
88
|
+
return d;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* RECIPE: title-sequence
|
|
2
|
+
16:9 brand title in beats, never static: a spark appears → blooms into light →
|
|
3
|
+
the wordmark rises out of it → a rule draws and the tagline lands → sign-off.
|
|
4
|
+
Particles drift and the light breathes the whole time.
|
|
5
|
+
ADAPT: change BRAND, TAGLINE, KICKER, SIGNOFF, PALETTE, FONT and PARTICLES
|
|
6
|
+
(embers rise, snow/dust sinks: use a negative rise). Keep the beat timing.
|
|
7
|
+
Run with build_from_script. */
|
|
8
|
+
|
|
9
|
+
const BRAND = 'Ember Roast';
|
|
10
|
+
const KICKER = 'SMALL-BATCH COFFEE';
|
|
11
|
+
const TAGLINE = 'Slow-roasted over open flame.';
|
|
12
|
+
const SIGNOFF = 'NOW POURING';
|
|
13
|
+
const FONT = 'Georgia'; /* ONE family, unquoted: Georgia · Helvetica Neue · Inter · Didot */
|
|
14
|
+
const PALETTE = { bg: '#0E0906', ink: '#F4E9DA', muted: '#A8927C', accent: '#F07A3A', glow: '#E8622A' };
|
|
15
|
+
const PARTICLES = { color: '#FFB27A', rise: 260, count: 36 };
|
|
16
|
+
const DURATION = 6;
|
|
17
|
+
|
|
18
|
+
const W = 1920, H = 1080, CX = W / 2, CY = H / 2 - 20;
|
|
19
|
+
const P = PALETTE, E = exode.ease;
|
|
20
|
+
const d = exode.artboard({ name: `${BRAND} title`, width: W, height: H, background: P.bg, ease: E.outQuart });
|
|
21
|
+
|
|
22
|
+
/* stage: vignette, light, particles */
|
|
23
|
+
d.rect({ name: 'Vignette', x: CX, y: H / 2, w: W, h: H, fill: exode.radial([{ offset: 0, color: '#000000', opacity: 0 }, { offset: 1, color: '#000000', opacity: 0.55 }], [0.5, 0.5], 0.75) });
|
|
24
|
+
const bloom = d.glow({ name: 'Bloom', x: CX, y: CY, size: 1500, color: P.glow, strength: 0.28, scaleY: 0.62 });
|
|
25
|
+
const core = d.glow({ name: 'Core light', x: CX, y: CY, size: 520, color: P.accent, strength: 0.45 });
|
|
26
|
+
const spark = d.ellipse({ name: 'Spark', x: CX, y: CY, size: 10, fill: '#FFF1E0' });
|
|
27
|
+
const embers = d.particles({ name: 'Embers', x: CX, y: CY + 160, w: 1300, h: 420, color: PARTICLES.color, count: PARTICLES.count, size: [3, 7], rise: PARTICLES.rise, spread: 22, opacity: 0.85, duration: DURATION });
|
|
28
|
+
|
|
29
|
+
/* type */
|
|
30
|
+
const kicker = d.text(KICKER, { name: 'Kicker', x: CX, y: CY - 150, size: 18, weight: 600, letterSpacing: 7, color: P.muted, align: 'center', w: 900, font: 'Helvetica Neue' });
|
|
31
|
+
const word = d.text(BRAND, { name: 'Wordmark', x: CX, y: CY - 20, size: 168, weight: 400, color: P.ink, align: 'center', w: 1600, font: FONT, letterSpacing: -3 });
|
|
32
|
+
const rule = d.rect({ name: 'Rule', x: CX, y: CY + 104, w: 220, h: 2, fill: P.accent });
|
|
33
|
+
const tag = d.text(TAGLINE, { name: 'Tagline', x: CX, y: CY + 156, size: 30, color: P.ink, align: 'center', w: 1200, font: FONT });
|
|
34
|
+
const sign = d.text(SIGNOFF, { name: 'Sign-off', x: CX, y: H - 110, size: 15, weight: 600, letterSpacing: 6, color: P.accent, align: 'center', w: 600, font: 'Helvetica Neue' });
|
|
35
|
+
|
|
36
|
+
/* beats (seconds) */
|
|
37
|
+
const t = { spark: 0.2, bloom: 0.9, word: 1.4, rule: 2.4, tag: 2.7, sign: 3.6 };
|
|
38
|
+
const intro = [
|
|
39
|
+
d.track(spark, 'opacity', [[0, 0, 'linear'], [t.spark, 0], [t.spark + 0.25, 1], [t.bloom + 0.3, 1], [t.bloom + 0.9, 0]]),
|
|
40
|
+
...d.track(spark, 'scale', [[0, 0.4, 'linear'], [t.spark, 0.4], [t.bloom, 1.4, E.in], [t.bloom + 0.5, 6]]),
|
|
41
|
+
d.track(core, 'opacity', [[0, 0, 'linear'], [t.bloom - 0.2, 0], [t.bloom + 0.6, 1]]),
|
|
42
|
+
...d.track(core, 'scale', [[0, 0.2, 'linear'], [t.bloom - 0.2, 0.2, E.outExpo], [t.bloom + 0.9, 1]]),
|
|
43
|
+
d.track(bloom, 'opacity', [[0, 0, 'linear'], [t.bloom, 0], [t.bloom + 1.2, 1]]),
|
|
44
|
+
d.track(kicker, 'opacity', [[0, 0, 'linear'], [t.word - 0.2, 0], [t.word + 0.6, 1]]),
|
|
45
|
+
d.track(kicker, 'y', [[0, CY - 130, 'linear'], [t.word - 0.2, CY - 130], [t.word + 0.8, CY - 150]]),
|
|
46
|
+
d.track(word, 'opacity', [[0, 0, 'linear'], [t.word, 0], [t.word + 0.9, 1]]),
|
|
47
|
+
d.track(word, 'y', [[0, CY + 30, 'linear'], [t.word, CY + 30], [t.word + 1.2, CY - 20]]),
|
|
48
|
+
...d.track(word, 'scale', [[0, 0.96, 'linear'], [t.word, 0.96], [t.word + 1.4, 1]]),
|
|
49
|
+
d.track(rule, 'scale_x', [[0, 0.001, 'linear'], [t.rule, 0.001, E.inOut], [t.rule + 0.7, 1]]),
|
|
50
|
+
d.track(tag, 'opacity', [[0, 0, 'linear'], [t.tag, 0], [t.tag + 0.8, 1]]),
|
|
51
|
+
d.track(tag, 'y', [[0, CY + 176, 'linear'], [t.tag, CY + 176], [t.tag + 0.9, CY + 156]]),
|
|
52
|
+
d.track(sign, 'opacity', [[0, 0, 'linear'], [t.sign, 0], [t.sign + 0.8, 1]]),
|
|
53
|
+
].flat().filter(Boolean);
|
|
54
|
+
d.intro(intro, 'Title beats');
|
|
55
|
+
|
|
56
|
+
/* ambient life for the whole piece: embers drift; once lit, the light breathes */
|
|
57
|
+
d.ambient([...embers.tracks], 'Embers drift', DURATION);
|
|
58
|
+
d.ambient([d.loopTrack(bloom, 'scale_x', (u) => 1 + 0.03 * Math.sin(u * Math.PI * 2), DURATION, 0.25)], 'Light breathe', DURATION);
|
|
59
|
+
|
|
60
|
+
d.input('brand', 'Text', BRAND);
|
|
61
|
+
d.input('tagline', 'Text', TAGLINE);
|
|
62
|
+
return d;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Games, dashboards and interactive apps: build hybrid native files
|
|
2
|
+
|
|
3
|
+
Use this for anything with a game loop, live data or many moving parts: games, simulations, dashboards, HUD-heavy apps. The goal is a file that runs fast and is still a real Exode file. When someone opens it in the editor, they should be able to expand the layers, see keyframes in Animate, and see inputs, states and interactions in Logic.
|
|
4
|
+
|
|
5
|
+
**The rule:** make everything native that can be native. Use code only for what can't be: a 3D world, physics, procedural fields, synthesised audio.
|
|
6
|
+
|
|
7
|
+
## Never do this
|
|
8
|
+
|
|
9
|
+
- **One giant CustomEffect that draws the whole app** (HUD, menus, buttons, world). The editor can't show its structure. If it auto-converts it to layers, it creates hundreds of live layers and the editor drops to ~12 fps.
|
|
10
|
+
- **Text, buttons or panels drawn with `fillText` and `fillRect` inside an effect.** These are invisible to Layers, Animate and Logic.
|
|
11
|
+
- **Hiding overlays with opacity 0 or scale 0 in the static file.** The editor draws low-opacity objects as ghosts and treats scale 0 as unset, so hidden panels pile up in the middle of the design view.
|
|
12
|
+
|
|
13
|
+
## Do this
|
|
14
|
+
|
|
15
|
+
1. **Split the code into named effect layers by role.** Each is an artboard-sized Rectangle with a CustomEffect. For example: `Sky & ground`, `Hazards ahead`, `Player`, `Passed objects`, `Speed FX`, and one `Game logic` layer. Use the same code in each layer, with a small `var GAME = { part: '...' }` prefix that tells `render()` which slice to draw. Only the `logic` part runs `update(env, dt)`; the other parts return early from `update`. Share state between parts per engine, never through one plain `globalThis.__yourApp` object: the editor runs its design canvas and two Preview engines in the same page, and a shared object makes them fight (duplicated, drifting scenes). Use the native kit's `NK_engine(env)` / `NK_key(env)` / `NK_state(key)` (`bake_native_layers { kit: true }`).
|
|
16
|
+
1b. **If the world is a structured scene** (a model, building, vehicle, machine, map), don't leave it as effect slices: make every meaningful part a native Path layer driven by the logic, and keep only glow as an effect. Read `get_motion_skill { topic: 'native-layers' }` and use `bake_native_layers`.
|
|
17
|
+
2. **Put the marker `EXODE_KEEP_LIVE` in a comment in heavy or game effects.** The editor then keeps them as live effects and doesn't convert them to layers. It also does this automatically above 160 shapes, but the marker states the intent. `add_custom_effect` adds the marker for you when the code defines `update()`.
|
|
18
|
+
3. **Make the HUD and UI native.** Use Text, Rectangle and Ellipse objects in named groups (`HUD · driver card`, `Overlay · result`, …).
|
|
19
|
+
- **Text:** text that changes binds to a Text input through `geometry.textInputId`. The script calls `env.setInput('scoreText', '1,234')`, and the text updates with no extra code.
|
|
20
|
+
- **Bars, icons and toasts:** the script sets properties directly: `env.scene.set('bat_fill', 'scale_x', k)` (and `x` to keep the bar left-aligned), or `env.scene.set('shield_2', 'opacity', 0.2)`.
|
|
21
|
+
- **Writes:** only write an input when its value changes.
|
|
22
|
+
4. **Keep logic in the state machine.** The script publishes state as inputs: a Number `phase` (0 countdown, 1 playing, 2 paused, 3 lost, 4 won), Booleans like `lowBattery` and `draft`, and Triggers like `hit`, fired with `env.scene.fire('hit')`. State layers react to them with `Equal`, `IsTrue` and `IsFalse` conditions: `Phase`, `Alerts`, `Slipstream`, `Hit flash`, `Ambient`. Give each layer its own objects and properties, so layers never write the same property.
|
|
23
|
+
5. **Make visual changes keyframed animations played by states.** Examples: panel reveals, a countdown pop, a HUD slide-in, warning pulses (`style.fill.color`), chip fades, a hit flash, and hover bobs on effect layers (keyframe the layer's `transform.y`). These are what Animate shows.
|
|
24
|
+
6. **Park overlays off the artboard.** Put pause, result and countdown panels just below the artboard, and the hit flash just above it. Each `show` animation moves the group to its home position and fades it in; `hide` fades it and moves it back. The panels stay visible and editable in the design view, and a parked or transparent object never catches clicks.
|
|
25
|
+
7. **Use interactions and navigation rules for buttons.** A button sets an input with a `Set Input` interaction (`retry = 1`), and the script reads it and clears it. Plain screen jumps are navigation rules (Start → Garage). Every button gets hover in/out animations.
|
|
26
|
+
8. **Use one project with several screens.** For example title, garage or menu, then one screen per level. Each screen has its own game-logic layer, and the script navigates with `env.scene.navigate(screenId)`.
|
|
27
|
+
9. **Draw a still frame in the design view.** When `update()` hasn't run yet, `render()` should create a preview state and draw a representative frame, not a black box.
|
|
28
|
+
10. **Synthesise audio with Web Audio inside the logic layer.** Create the `AudioContext` lazily after the first key or pointer gesture. Use `ctx.currentTime` for parameter ramps; an `AudioParam` has no `.context`, and an exception there silently disables the whole script.
|
|
29
|
+
|
|
30
|
+
## Check before you hand it over
|
|
31
|
+
|
|
32
|
+
- In the editor, the layers panel shows named groups, Animate lists the animations, and Logic shows inputs, state layers and interactions.
|
|
33
|
+
- The design view frame time stays under 17 ms. Measure it with a requestAnimationFrame loop in a headed browser.
|
|
34
|
+
- Scripts swallow their own errors. Look for `[ExodeUI] effect script error` in the console after a playthrough.
|
|
35
|
+
- A bot playthrough reaches every phase: countdown, playing, paused, lost and won.
|
|
36
|
+
|
|
37
|
+
The reference implementation is Sky Roadster (`scripts/games/sky-roadster/` in the Exode repo): five screens, about 77 layers per level, 26 animations, 25 inputs and 7 state layers.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Runtime gotchas: rules the file format doesn't show
|
|
2
|
+
|
|
3
|
+
Each rule here once cost a debugging round. None of them is visible from the schema, and most fail silently: the file validates, then renders wrong. Read this before writing objects, keyframes, state machines or effect code.
|
|
4
|
+
|
|
5
|
+
## Objects and layout
|
|
6
|
+
|
|
7
|
+
- **Objects are a flat list.** A parent's `children` holds id strings; each child has `parentId`. Child transforms are relative to the parent.
|
|
8
|
+
- **Group hugs, Frame keeps its size.** A `Group` with `layoutSizing: fixed` still hugs its content (and re-centres it). A `Frame` keeps its size, but the runtime never paints Frame fills. For a fixed-size button: a hugging Group with padding around a fixed-width label, and the fill on a Rectangle inside.
|
|
9
|
+
- **A parent Group halves code-animation offsets** because it re-centres on its content. Keyframe or offset a Frame instead when exact travel matters.
|
|
10
|
+
- **Layout solver:** a `fill` child with `maxWidth` is clamped but not re-centred under `alignItems: center`. Use a fixed width plus `responsive.bp_mobile: { layoutSizingHorizontal: 'fill' }`.
|
|
11
|
+
- **Render order at the root is the state `zIndex`.** Runtime z on many items (slides, cards) collides with page objects; wrap them in their own Group so the sort is siblings-only.
|
|
12
|
+
- **Hiding things:** never stack alternates as invisible objects in one spot. The editor's design view draws objects with opacity < 0.5 at 50% while not playing, so 10 hidden captions open as an unreadable pile. Reuse one object and keyframe its text/size/position. Hide alternates with `scale 0`, park overlays below the artboard, or give scene Groups a `visible` track (property `visible`, not `transform.visible`) with `isVisible: false` on later scenes.
|
|
13
|
+
|
|
14
|
+
## Text
|
|
15
|
+
|
|
16
|
+
- **`fontFamily` is ONE unquoted family:** `Georgia`, `Helvetica Neue`. The engine wraps it as `"${family}", sans-serif`, so `Georgia, serif` becomes one unknown family (sans fallback), and a pre-quoted name breaks the string and renders at 10px. Effect code sets its own `ctx.font`, so lists work there.
|
|
17
|
+
- **Text keyframes between digit-leading strings interpolate as numbers.** `"8.9k"` → `"12.1k"` shows `"10"`, and any segment whose two strings both start with a digit renders only the number, even when they are identical (`"4 frames"` shows `"4"`). Hold the old value until 0.001 s before the swap, or spell numbers out. Upside: `"0"` → `"618"` counts up for free.
|
|
18
|
+
- **Formatted count-ups:** interpolation runs `parseFloat` on both strings (leading whitespace is skipped), so "48,210" counts as 48. Prefix each intermediate string with a zero-width space (U+200B) to force a plain swap, or use the kit's `d.countUp()`.
|
|
19
|
+
- **Effects that decorate text:** a Text object whose CustomEffect code calls `fillText` suppresses the native glyphs; with effects off, the plain text renders. Use this so effects decorate real, editable text instead of replacing it.
|
|
20
|
+
|
|
21
|
+
## Paths
|
|
22
|
+
|
|
23
|
+
- **Paths re-centre on their bounding box every frame,** so a morphing or bending path drifts. Fix: prepend two `moveTo` "pin" points at fixed corners of the box (they draw nothing) and set `width/height/baseWidth/baseHeight` to the pinned box. If the source path then starts with a lowercase `m`, rewrite it to `M` (it would be relative to the last pin).
|
|
24
|
+
- **Author path data centred on its own bbox.** The editor draws `data` around (0,0) at the object position; the runtime re-centres on the bbox. Off-centre data shows parts offset in the editor.
|
|
25
|
+
- **`width/baseWidth` never scales points** (the renderer overrides baseWidth with width). Scale the path data itself: multiply every number except an arc's rotation and flags.
|
|
26
|
+
- **Stroke width ignores a scaled parent:** set it in artboard pixels.
|
|
27
|
+
- **Trim with round caps:** `trimStart == trimEnd`, or a zero-length dash, draws a dot on older runtimes. Hide the path instead of trimming to zero.
|
|
28
|
+
|
|
29
|
+
## Keyframes and animation
|
|
30
|
+
|
|
31
|
+
- **Keyframed animations only play from a state machine state.** A file with animations but no `stateMachine.layers` renders static.
|
|
32
|
+
- **Easing lives on the keyframe where a segment STARTS.** Easing on the last keyframe does nothing.
|
|
33
|
+
- **Opacity above 1 is read as a percentage** (1.24 → 1.2%). Never overshoot opacity or fill opacity: not in keyframes, and not through a cubic-bezier with y > 1.
|
|
34
|
+
- **`codeAnimations` (`animate(t, o, params, ctx)`) add offsets to the static transform** and override that object's keyframes. To combine, keyframe a parent Frame and code-animate the child.
|
|
35
|
+
- **Morphs and blends mix only numbers and colours.** Morph paths with one track per coordinate (`geometry.points.3.x`), never whole `geometry.points` arrays. Every pose in a blend must carry the same tracks, or missing values get pulled toward 0.
|
|
36
|
+
|
|
37
|
+
## State machine and interaction
|
|
38
|
+
|
|
39
|
+
- **Two layers writing the same property fight,** and a finished non-looping state keeps writing its last frame forever. Give each object exactly one owner; split ownership with extra Group or Bone levels.
|
|
40
|
+
- **No transition blending, no exit time,** and a transition with empty conditions fires every frame. For a replayable one-shot, alternate two states on one Trigger, each ending on the rest pose.
|
|
41
|
+
- **Transitions are evaluated from any state.** Whatever state is current, a transition anywhere in the layer whose conditions hold can fire. It is skipped only if its target is already active. So a held condition (`phase == 1`, a Boolean) aimed at two different states flips between them every frame, restarting their animations. Give each held condition one target state, or drive phase changes with one-shot Triggers fired from logic (`env.scene.fire('started')`).
|
|
42
|
+
- **Triggers are global:** any trigger re-enters the matching state in every layer. Non-action layers should hold poses, or they replay on every tap.
|
|
43
|
+
- **`applyState` uses BARE names for transforms** (`x`, `scale_x`, `opacity`); `transform.x` writes nothing visible. Dotted paths are right for style and geometry (`style.stroke.color`).
|
|
44
|
+
- **The runtime fires only the first interaction per object per event.** Put `setInput` and the highlight tween in one interaction.
|
|
45
|
+
- **Hit areas:** a Rectangle with fill opacity 0.001 on top; `onPointerEnter` → fireTrigger, `onClick` → fireTrigger or 'Toggle Boolean'.
|
|
46
|
+
- **Joysticks:** use `add_joystick` (it writes the real `Joystick` object). Property bindings need `actionType: 'bind'`; `isContinuous: true` is velocity mode (keeps moving while held), not position. Every joystick also publishes `<id>_x` / `<id>_y` inputs (-1..1).
|
|
47
|
+
- **Testing drags:** `preview_frames` pointer keys are 0–1 fractions of the frame, and only the sampled `times` run. Include a sample at or just after the press, then sample densely through the drag.
|
|
48
|
+
- **Pointer inputs** can use `pointerAxis`, `pointerOrigin` (object id) and `smoothing`/`bounce` springs, so a file follows the pointer smoothly without host code.
|
|
49
|
+
|
|
50
|
+
## Bones
|
|
51
|
+
|
|
52
|
+
- Rest rotation 0; shapes parented to a bone follow rigidly. Create the head chain after the body shapes or the body draws over the face.
|
|
53
|
+
- Prefer rigid parenting plus point morphs over skinning (weights drift with path re-centring). No meshes, FFD or physics joints at runtime.
|
|
54
|
+
|
|
55
|
+
## Physics
|
|
56
|
+
|
|
57
|
+
- **Scene physics on = every Shape is a body.** When `artboard.physics.enabled` is true, every Shape without its own `physics` block becomes a dynamic body: text, buttons and backgrounds fall. Give everything that must stay put `physics: { enabled: false }`, and give real bodies an explicit block.
|
|
58
|
+
- **`collideWithBounds` traps bodies that start outside.** To drop things in from above, use static walls and a floor just outside the artboard instead of the bounds.
|
|
59
|
+
- **Weight comes from low restitution:** 0.1–0.3 lands and settles, above 0.7 bounces forever and reads as a toy. Add a little `frictionAir` (0.01–0.03).
|
|
60
|
+
- **Gravity must be set in the file.** Dynamic bodies with zero gravity and no `update()` effect never move on their own; website showcases often switched gravity on from host JavaScript.
|
|
61
|
+
|
|
62
|
+
## Images
|
|
63
|
+
|
|
64
|
+
- Image geometry ignores `cornerRadius`: round it with a clipping Group (`clipContent`, cornerRadius).
|
|
65
|
+
- Images stretch to their box: pre-crop to the exact aspect.
|
|
66
|
+
- `{type: 'Image', src: dataURI}` preloads on load (no blank first frames); remote images can be blank in early sampled frames.
|
|
67
|
+
- **Gradient stops must be hex** with a separate `opacity` per stop. An `rgba()` stop is painted white.
|
|
68
|
+
- A RadialGradient's radius uses max(w, h): for an oval glow, draw a circle and `scale_y` it.
|
|
69
|
+
|
|
70
|
+
## Effect code (CustomEffect)
|
|
71
|
+
|
|
72
|
+
- **The compiler minifies effect code:** it collapses whitespace, strips `//` comments and renames some identifiers. Use explicit semicolons and `/* */` comments only, never write `- -`, and never put `//` inside strings.
|
|
73
|
+
- **Effects swallow their own exceptions** and show a half-drawn frame. Check late states too: a `const` used before its declaration may throw only once a lid is 83% open. Run `preview_frames` across the whole duration, not just the start.
|
|
74
|
+
- **Per-engine state:** the editor canvas, Preview and the player run the same file at once. Key module state by engine (see the `native-layers` topic), never one shared `globalThis` object.
|
|
75
|
+
- `env.pointer.localX/localY/isDown` arrive every frame. `preview_frames` only runs the sampled times, so a tap must land inside a sampled window; test interaction with a video render.
|
|
76
|
+
|
|
77
|
+
## Performance
|
|
78
|
+
|
|
79
|
+
- The real target is a 120 Hz Retina display. Many live canvases means many GPU uploads, and a backdrop blur over a live canvas re-blurs every frame.
|
|
80
|
+
- Don't decompose a whole app into hundreds of effect layers (409 layers ran at 12 fps). Follow the `apps` and `native-layers` topics: about 50 semantic native parts plus a few light effects hold 120 fps.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Native layers for code-drawn scenes
|
|
2
|
+
|
|
3
|
+
Use this whenever effect code draws a **structured scene**: a 3D model, building, vehicle, machine, map, anatomy, exploded diagram, or a wireframe or hologram of anything. The scene must end up as real, named layers that people can select, recolour, hide and move in the editor. It must also keep **everything** the effect did (motion, explode/assemble, orbit, picking, x-ray, sound) and run at display rate (120 fps on a 120 Hz Mac).
|
|
4
|
+
|
|
5
|
+
Reference implementation: `showcases/hologram-temple` in the Exode repo. It's a South Indian temple hologram with 48 native Path layers in 8 part groups (Rajagopuram → Tala 1…7 …), 6 logic layers and 1 glow effect, and runs at 117 fps at DPR 2.
|
|
6
|
+
|
|
7
|
+
## Why not the other two ways
|
|
8
|
+
|
|
9
|
+
- **One big effect.** The editor shows one opaque box, and nothing inside it can be edited.
|
|
10
|
+
- **The editor's generic "convert effect to layers".** It records canvas draw calls, so you get hundreds of layers with no meaning. Sky Roadster became 409 layers and ran at 12 fps.
|
|
11
|
+
- **The right split follows the scene's own structure.** One Path layer per meaningful part, usually 20–80 layers. The code only rewrites their points each frame.
|
|
12
|
+
|
|
13
|
+
## The recipe
|
|
14
|
+
|
|
15
|
+
1. **Model the parts.** Build the geometry once (edges, polylines) and tag every primitive with its part and sub-part: `Rajagopuram / Tala 3`, `Mandapa / Pillars`, `Garbhagriha / Shiva linga`. Keep each sub-part's primitives contiguous, so its points sit in one range.
|
|
16
|
+
2. **Write the effect with the native kit.** Get it with `bake_native_layers { kit: true }` and paste it once into the shared script. It provides these functions:
|
|
17
|
+
- `NK_engine(env)`: put it at the top of the **first** logic layer's `update()`. It gives this engine its own key, stored in the `engineKey` input.
|
|
18
|
+
- `NK_key(env)` and `NK_state(key)`: per-engine state in `update()` and `render()`. Without a key (the editor design view) you get `'still'`; draw the still from it.
|
|
19
|
+
- `NK_pool(id, n)`: one reusable point array per Path layer. Never allocate per frame.
|
|
20
|
+
- `NK_begin`, `NK_move`, `NK_line`, `NK_close`, `NK_end`, `NK_push(env, pool)`: rewrite a layer's points in artboard coordinates each frame.
|
|
21
|
+
- `NK_set(st, env, id, prop, v)`: write opacity or colour only when it changes.
|
|
22
|
+
3. **Add `nativeBake()`.** It returns `{ groups, layers }`:
|
|
23
|
+
- `groups: [{ id, name, parent?, locked? }]`.
|
|
24
|
+
- `layers: [{ id, name, parent, pts: NK_pts(pool), stroke, width, fill?, fillOpacity?, opacity?, blend?: 'screen' | 'normal', locked? }]`.
|
|
25
|
+
- Produce the still the same way the runtime does: project at the home camera into pools, then `NK_pts`. That keeps one source of truth.
|
|
26
|
+
4. **Call `bake_native_layers { path }`.** For each part it creates a Group/Path tree with a **tight frame** around the geometry, placed just below the effect. It writes `var NATIVE_ORG = {id: [cx, cy]}` into the code and adds the `engineKey` input. Re-run it whenever `nativeBake()` changes.
|
|
27
|
+
5. **Split the logic into small named layers.** Put them in a `Logic` group and run them in order. Each is the same script with its own `var APP = { part: 'logic_camera' }` prefix:
|
|
28
|
+
- `Input · orbit, keys, picking`: pointer, keys, button inputs. It calls `NK_engine`.
|
|
29
|
+
- `Deconstruct & …`: eases the scene parameters.
|
|
30
|
+
- `Camera`: momentum, auto-orbit, focus.
|
|
31
|
+
- `Projection → layers`: projects once, then `NK_push` per layer and opacity or colour per layer.
|
|
32
|
+
- `HUD sync`: text inputs, labels, slider.
|
|
33
|
+
- `Sound`.
|
|
34
|
+
5b. **Give every piece only its own code.** Put shared code (model, camera maths, projection, helpers) in one `Shared library` effect, first in the Logic group. Load it with `var LIB_ID = '<name>-<hash of the library code>'`; at load time it registers its functions with `globalThis.__exodeLibs[LIB_ID] = { … }`. Give it empty `update`/`render` so the engine and the editor load it first. Each piece is then 15–40 lines: a header comment saying what it does, `var L = __exodeLibs[LIB_ID]`, and its own `update()`. In the editor:
|
|
35
|
+
- Selecting the Logic group shows all pieces in Effects Studio ("In this group", plus an **All** view with every piece's code in layer order).
|
|
36
|
+
- Selecting one piece shows only that piece.
|
|
37
|
+
- Hashing the id means two versions of a file never share functions.
|
|
38
|
+
- Mark every piece `EXODE_KEEP_LIVE`.
|
|
39
|
+
- Don't run `optimize_effects` on pieces that have no constant prefix. It leaves them untouched now, so their comments stay.
|
|
40
|
+
5c. **Give the Logic group its own effect: a mirror of the pieces.** Put one effect on the group: `{ type: 'CustomEffect', name: 'Logic effect (all N)', groupMirror: true, isEnabled: false, code }`. The code is every piece's code in layer order, each piece under `/* ═════ <layer name> ═════ [<layerId>#<effectIndex>] */`. The editor keeps it in sync with the pieces. Editing it in Effects Studio and pressing Update writes each changed section back to its piece as one undo step. Being disabled, it never runs twice. **Don't write it by hand:** `bake_native_layers` adds it to every group with two or more logic pieces, `mirror_group_effects` adds it to any group you name, and every MCP write keeps it in sync. In Effects Studio, selecting the group shows the full code in the main area and each piece's snippet in the right-hand column (Jump / Open).
|
|
41
|
+
6. **Keep only light as an effect.** One `Glow` effect draws what paths can't: bloom under the lines, scan sweeps, radial light, ripples, dashed guides. It reads the projected edges that the Projection layer stored on `NK_state(NK_key(env))`.
|
|
42
|
+
6b. **Give every piece its settings as top-level variables.** The Effects panel shows each top-level `var NAME = <number | colour | true/false>` as a control (slider, colour picker, toggle). Write the values people would tune there, not inline: `var BLOOM_ALPHA = 0.16, BLOOM_WIDTH = 3.4;` then `ctx.lineWidth = BLOOM_WIDTH`. Name them after the section and what they do (`TEMPLE_TANK_RIPPLES_SPEED`, `ZOOM_SPEED`). Keep ids (`LIB_ID`), buffers and structure (loop bounds, indices) out of them. **Every MCP write does this for you** (`effectKnobs.ts`): line widths, glow and shadow blur, fill and stroke colours, time rates (`t * 2.4`, `dt * 0.6`) and opacity factors in `rgba()` or fill/stroke style expressions are moved to named top-level variables. Output stays identical, and the shared library and group mirrors are left alone. Each setting is also declared as a state-machine input (`bloomWidth`, Number or Color; prefixed with the layer id on a clash, e.g. `camMotionYawSpeed`), so it shows in the runtime controls and a host can set it (`<ExodeUICanvas inputs={{ bloomWidth: 8 }}>`). A generated `KNOB_apply(env)` block at the end of the effect reads them each frame: a host value wins once it moves off the default, otherwise the code's value is used, so editor edits keep working. The editor keeps each input's default in step with its setting. Don't write the block by hand: it is regenerated on every MCP write.
|
|
43
|
+
7. **Make the stage native too.** The backdrop is a Rectangle with a RadialGradient fill, the vignette a radial gradient from transparent to black, and the horizon shade a LinearGradient. Grids, rings, beams and particles are Path layers written like the parts. Scanlines are one static Path.
|
|
44
|
+
8. **Lock the background.** Lock the backdrop, grids, rings, atmosphere, glow and logic layers (`isLocked: true`), so canvas clicks reach the parts. People can unlock them in Layers.
|
|
45
|
+
|
|
46
|
+
## Rules that cost a debugging round each
|
|
47
|
+
|
|
48
|
+
- **Per-engine state.** The editor runs the design canvas renderer and two Preview engines in one page. Shared `globalThis` state makes them fight: one temple moves and duplicates, or the design view orbits. Always use `NK_engine` / `NK_key`.
|
|
49
|
+
- **Never change the shape of a global without renaming it.** A long-lived editor tab still holds the old object. The temple's v4 crashed on `null.beat` and every interaction died. The kit's root is versioned (`__exodeNativeV1`), and its cleanup skips anything that isn't an engine record.
|
|
50
|
+
- **Path frames.** The engine scales points by live width ÷ authored width and centres them on their bounding box. The kit pins every pool far outside any artboard (±1,000,000) and the bake keeps width equal to baseWidth, so points land exactly where you write them, relative to the layer's frame centre. If someone moves the layer in the editor, the part moves with it.
|
|
51
|
+
- **Respect edits.** Read each layer's colour once from `env.scene.get(id).style.stroke.color`, then tint from that base (for example, saffron when selected). Don't overwrite what the user set.
|
|
52
|
+
- **Blend.** Layers are `normal` by default. Ask for `blend: 'screen'` in `nativeBake()` only for additive looks (holograms, neon); the bake then sets `style.compositeOperation: 'screen'`, which the engine prefers over `blendMode`.
|
|
53
|
+
- **Hit-testing.** Full-artboard paths with long outlines grab every click. The bake gives tight frames, and `lint_artboard` flags any that are left.
|
|
54
|
+
|
|
55
|
+
## Check before handing over
|
|
56
|
+
|
|
57
|
+
- **Interactions.** Use a real pointer and keys, on the web page **and** in the editor Preview: select via the list and via a 3D click, explode, slider, x-ray, drag-orbit and reset. No `effect script error` in the console.
|
|
58
|
+
- **Stale page.** Open the file in a page that already ran an older version of the effect, not only a fresh one.
|
|
59
|
+
- **Design view.** One still temple and no motion except light. Selecting a part from Layers shows a tight box, and a canvas click selects one part.
|
|
60
|
+
- **Speed.** In a headed Chrome at DPR 2, rAF stays at display rate and engine time per frame stays under 8.3 ms.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Quality bar: what "excellent" means for an Exode file
|
|
2
|
+
|
|
3
|
+
Read this before building anything visible. These are the rules that separate a file that looks directed from one that looks generated.
|
|
4
|
+
|
|
5
|
+
## 1. The user's intent comes first
|
|
6
|
+
|
|
7
|
+
- **Build what was asked, at the scale it was asked.** A button hover is a snappy, tasteful hover driven by native transforms and a state machine trigger. It is not a cinematic intro, a 3D title sequence or a keynote reveal.
|
|
8
|
+
- **Never force a template.** No Apple-keynote framing, notch reveals, rain titles or fixed video structures unless the user names them.
|
|
9
|
+
- **Adopt the requested style completely:** minimal, glassmorphic, neo-brutalist, editorial, dark, light, colourful, playful. When the user gives a palette, font or brand, use it exactly and add nothing that fights it.
|
|
10
|
+
- **Don't add unasked-for spectacle.** One idea, executed well, beats five effects stacked.
|
|
11
|
+
|
|
12
|
+
## 2. When the brief leaves style open: premium by default
|
|
13
|
+
|
|
14
|
+
With no style given, aim for top-tier agency or Awwwards work, not a widget kit.
|
|
15
|
+
|
|
16
|
+
- **Format:** desktop web (landscape, e.g. 1440×900 or 1200×760) that stays usable down to mobile through responsive breakpoints, unless the brief is clearly mobile, social or an icon.
|
|
17
|
+
- **Palette:** dark or editorial. Build 1 neutral ramp (5–7 steps) plus 1 accent, and use the accent sparingly (about 10% of the surface). Avoid default blue `#3b82f6`, flat saturated toy colours, pure `#000` on pure `#fff`, and rainbow gradients.
|
|
18
|
+
- **Typography:** one family (two at most), real hierarchy through size and weight steps (e.g. 64 / 24 / 15 / 12), tight tracking on large display type, generous line height on body text. Two-tone headlines (ink plus a muted grey) read more refined than bold colour.
|
|
19
|
+
- **Surfaces:** subtle depth instead of chrome. Use soft layered shadows, a 1px hairline at 6–12% white or black, light grain, glow only where light would actually be, and glass only over something worth blurring.
|
|
20
|
+
- **Shapes:** consistent corner radii from one scale. Pill and sticker shapes, emoji and clip-art icons read as cartoonish; avoid them unless the brief is playful.
|
|
21
|
+
- **Space:** generous whitespace and one focal object per view. If everything is emphasised, nothing is.
|
|
22
|
+
- **No decorative chrome:** no fake window traffic lights, no mono "eyebrow" labels on everything, no glow buttons on every CTA.
|
|
23
|
+
|
|
24
|
+
## 3. Motion that feels expensive
|
|
25
|
+
|
|
26
|
+
- Follow the motion-language spec from the overview: one signature easing, one base timing unit, one transition family.
|
|
27
|
+
- **Micro-interactions:** 120–240 ms, ease-out, travel ≤ 4 px, scale 0.97–1.03. Hover lifts, press compresses, release settles. Every interactive object answers hover AND press.
|
|
28
|
+
- **Entrances:** stagger related elements 40–80 ms in reading order; the hero arrives first or last, never in the middle of the crowd.
|
|
29
|
+
- **Idle life:** an ambient loop (breathing glow, slow drift, light sweep) at low amplitude and a 4–12 s period keeps a hero alive without demanding attention.
|
|
30
|
+
- **Physics and gravity are a hero, not a gimmick.** Give bodies real mass differences, restitution between 0.2 and 0.6, some air friction, and a reason to fall (a user action, a reveal, a release). The result should feel weighty and settle cleanly, not bounce forever.
|
|
31
|
+
- **Respect the gotchas** (topic `gotchas`): opacity never above 1, easing on the starting keyframe, and one owner per property.
|
|
32
|
+
|
|
33
|
+
## 4. Native first, and explorable in the editor
|
|
34
|
+
|
|
35
|
+
- **Use native primitives** (Text, Rectangle, Ellipse, Path, Group, Bone, Image, widgets) with keyframes, state machine inputs and interactions. Text stays real, editable Text.
|
|
36
|
+
- **Effect code is for what native objects can't express:** particles, flow fields, light, procedural textures. For games, simulations and dashboards, follow the `apps` and `native-layers` topics: named effect layers per world slice, native HUD bound to inputs, and a state machine.
|
|
37
|
+
- **Every file must be explorable:** meaningful layer names ("Hero title", "Card / price"), not "Rectangle 7". Group by purpose, and keep visible Layers, Animate and Logic panels with no hidden stacks or 50%-ghost piles.
|
|
38
|
+
- **Make it customisable:** expose what a user would want to change (text, key colours, speed, intensity, on/off states) as state machine inputs with sensible defaults, plus a `replay` trigger for entrances.
|
|
39
|
+
- **Keep it fast:** hardware-friendly transforms and opacity, few live canvases, and no heavy CPU shaders for things a gradient or keyframe can do.
|
|
40
|
+
|
|
41
|
+
## 5. Learn from the examples before you build
|
|
42
|
+
|
|
43
|
+
Call `list_examples`, pick the 1–2 closest to the brief, and read them with `get_example` (start with `mode: "outline"`; use `mode: "effects"` for effect code). Copy their **structure and craft** (layer organisation, state machine shape, input naming, timing, surface treatment), not their subject, palette or layout. Two different briefs must not come out looking alike.
|
|
44
|
+
|
|
45
|
+
## 6. Build it in one script
|
|
46
|
+
|
|
47
|
+
For anything beyond a few objects, use `build_from_script`: one script with the bundled kit (palette, type scale, loops for layout, `reveal` for entrances, `interactive` for hover and press, `physics`/`walls`/`body` for gravity). One script keeps spacing, timing and colour consistent the way a hand-built file never does, and rerunning it is cheap. Each run returns the design check and a contact sheet.
|
|
48
|
+
|
|
49
|
+
## 7. Check it like a director
|
|
50
|
+
|
|
51
|
+
1. `critique_artboard` (design check: stock colours, contrast, overflow, dead controls, property fights, inert physics…) and `validate_artboard`: fix every ✖ and ▲.
|
|
52
|
+
2. `preview_frames` across the whole duration (and inside interaction windows for taps). Look at the contact sheet.
|
|
53
|
+
3. Critique against `qc` and this page: hierarchy, spacing, contrast, easing and rhythm, anything cartoonish or default-looking. Fix it and look again, at least twice.
|
|
54
|
+
4. Deliver with one line on what could change (another look, length, aspect, interaction).
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { readdirSync, readFileSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { runBuildScript } from '../buildKit';
|
|
4
|
+
import { critiqueArtboard } from '../critique';
|
|
5
|
+
|
|
6
|
+
const codes = (doc: any) => critiqueArtboard(doc).map((i) => i.code);
|
|
7
|
+
|
|
8
|
+
describe('build kit', () => {
|
|
9
|
+
test('a script builds a wired, named document', () => {
|
|
10
|
+
const { doc } = runBuildScript(`
|
|
11
|
+
const d = exode.artboard({ name: 'Hero', width: 1200, height: 700, palette: 'paper' });
|
|
12
|
+
const P = exode.palette('paper');
|
|
13
|
+
const t = d.text('Hello', { name: 'Title', left: 80, y: 200, size: 64, color: P.ink });
|
|
14
|
+
const b = d.rect({ name: 'Start button', left: 80, y: 320, w: 180, h: 48, r: 24, fill: P.accent });
|
|
15
|
+
d.intro(d.reveal([t]));
|
|
16
|
+
d.interactive(b);
|
|
17
|
+
return d;`);
|
|
18
|
+
expect(doc.objects).toHaveLength(2);
|
|
19
|
+
expect(doc.stateMachine.layers.map((l: any) => l.name)).toEqual(['Intro', 'Start button interaction']);
|
|
20
|
+
expect(doc.objects[1].interactions.map((i: any) => i.event)).toEqual(['onPointerEnter', 'onPointerLeave', 'onPointerDown']);
|
|
21
|
+
expect(codes(doc)).not.toContain('dead-controls');
|
|
22
|
+
expect(codes(doc)).not.toContain('property-fight');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('scene physics: only body() objects take part; walls let bodies fall in', () => {
|
|
26
|
+
const { doc } = runBuildScript(`
|
|
27
|
+
const d = exode.artboard({ width: 800, height: 600 });
|
|
28
|
+
d.physics({ gravity: [0, 9.8] });
|
|
29
|
+
d.text('Label', { name: 'Label', x: 400, y: 100 });
|
|
30
|
+
d.walls();
|
|
31
|
+
d.body(d.rect({ name: 'Tile', x: 400, y: -80, w: 120, h: 40 }));
|
|
32
|
+
return d;`);
|
|
33
|
+
expect(doc.objects.find((o: any) => o.name === 'Label').physics).toEqual({ enabled: false });
|
|
34
|
+
expect(doc.objects.find((o: any) => o.name === 'Tile').physics.bodyType).toBe('Dynamic');
|
|
35
|
+
expect(doc.objects.find((o: any) => o.name === 'Floor').physics.bodyType).toBe('Static');
|
|
36
|
+
expect(doc.physics.collideWithBounds).toBe(false);
|
|
37
|
+
expect(codes(doc)).not.toContain('implicit-bodies');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('gradient stops are hex + opacity, never rgba()', () => {
|
|
41
|
+
const { doc } = runBuildScript(`
|
|
42
|
+
const d = exode.artboard({});
|
|
43
|
+
d.ellipse({ name: 'Glow', size: 400, fill: exode.radial([exode.alpha('#FF8A5C', 0.2), exode.alpha('#FF8A5C', 0)]) });
|
|
44
|
+
return d;`);
|
|
45
|
+
const stops = doc.objects[0].style.fill.stops;
|
|
46
|
+
expect(stops[0]).toMatchObject({ color: '#FF8A5C', opacity: 0.2 });
|
|
47
|
+
expect(stops[1]).toMatchObject({ color: '#FF8A5C', opacity: 0 });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('scripts are sandboxed and must return the builder', () => {
|
|
51
|
+
expect(() => runBuildScript(`return require('fs')`)).toThrow();
|
|
52
|
+
expect(() => runBuildScript(`const d = exode.artboard({});`)).toThrow(/return d/);
|
|
53
|
+
expect(() => runBuildScript(`while (true) {}`, { timeoutMs: 200 })).toThrow();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('critique', () => {
|
|
58
|
+
const base = (objects: any[], extra: any = {}) => ({ name: 'A', width: 800, height: 600, backgroundColor: '#0B0A0F', objects, animations: [], stateMachine: { inputs: [], layers: [] }, ...extra });
|
|
59
|
+
const rect = (o: any) => ({ id: o.name, type: 'Shape', transform: { x: 100, y: 100, opacity: 1 }, geometry: { type: 'Rectangle', width: 100, height: 40 }, style: { fill: { type: 'Solid', color: '#222222', opacity: 1 } }, ...o });
|
|
60
|
+
|
|
61
|
+
test('flags stock colours, implicit physics bodies, rgba stops and opacity overshoot', () => {
|
|
62
|
+
const doc = base([
|
|
63
|
+
rect({ name: 'Card', style: { fill: { type: 'Solid', color: '#3b82f6', opacity: 1 } } }),
|
|
64
|
+
rect({ name: 'Glow', style: { fill: { type: 'RadialGradient', stops: [{ offset: 0, color: 'rgba(255,0,0,0.2)' }] } } }),
|
|
65
|
+
rect({ name: 'Ghost', transform: { x: 300, y: 300, opacity: 1.2 } }),
|
|
66
|
+
], { physics: { enabled: true, gravity: { x: 0, y: 9.8 } } });
|
|
67
|
+
expect(codes(doc)).toEqual(expect.arrayContaining(['stock-colours', 'implicit-bodies', 'gradient-stop-colour', 'opacity-over-1']));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('percent opacity (100) and parked text are not errors', () => {
|
|
71
|
+
const doc = base([
|
|
72
|
+
rect({ name: 'Panel', style: { fill: { type: 'Solid', color: '#222222', opacity: 100 } } }),
|
|
73
|
+
{ id: 'parked', name: 'Parked caption', type: 'Shape', transform: { x: 400, y: 900 }, geometry: { type: 'Text', text: 'Later', fontSize: 16, fontFamily: 'Inter', width: 80, height: 24 }, style: { fill: { type: 'Solid', color: '#FFFFFF' } } },
|
|
74
|
+
]);
|
|
75
|
+
expect(codes(doc)).not.toContain('opacity-over-1');
|
|
76
|
+
expect(codes(doc)).not.toContain('text-off-artboard');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('animations with no state machine render static', () => {
|
|
80
|
+
const doc = base([rect({ name: 'Box' })], { animations: [{ id: 'a', name: 'Spin', duration: 1, tracks: [{ object_id: 'Box', property: 'transform.rotation', keyframes: [{ time: 0, value: 0 }, { time: 1, value: 90 }] }] }] });
|
|
81
|
+
expect(codes(doc)).toContain('no-state-machine');
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe('recipes and ready-made pieces', () => {
|
|
86
|
+
const dir = join(process.cwd(), 'skills', 'creative-motion', 'recipes');
|
|
87
|
+
for (const f of readdirSync(dir).filter((x: string) => x.endsWith('.js'))) {
|
|
88
|
+
test(`recipe ${f} builds with a clean design check`, () => {
|
|
89
|
+
const { doc, warnings } = runBuildScript(readFileSync(join(dir, f), 'utf8'));
|
|
90
|
+
expect(warnings).toEqual([]);
|
|
91
|
+
expect(critiqueArtboard(doc).filter((i) => i.severity !== 'tip')).toEqual([]);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
test('button: label rides inside the pill and the pill answers hover and press', () => {
|
|
96
|
+
const { doc } = runBuildScript(`const d = exode.artboard({}); d.button('Go', { x: 100, y: 100 }); return d;`);
|
|
97
|
+
const pill = doc.objects.find((o: any) => o.name === 'Go button');
|
|
98
|
+
expect(doc.objects.find((o: any) => o.name === 'Go label').parentId).toBe(pill.id);
|
|
99
|
+
expect(pill.interactions.map((i: any) => i.event)).toEqual(['onPointerEnter', 'onPointerLeave', 'onPointerDown']);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('loopTrack is seamless: first and last values match, times ascend', () => {
|
|
103
|
+
const { doc } = runBuildScript(`const d = exode.artboard({}); const p = d.particles({ x: 0, y: 0, w: 100, h: 100, color: '#FFFFFF', count: 5 }); d.ambient(p.tracks); return d;`);
|
|
104
|
+
for (const tr of doc.animations[0].tracks) {
|
|
105
|
+
const ks = tr.keyframes;
|
|
106
|
+
expect(ks[0].value).toBeCloseTo(ks[ks.length - 1].value, 5);
|
|
107
|
+
for (let i = 1; i < ks.length; i++) expect(ks[i].time).toBeGreaterThan(ks[i - 1].time);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('effect knobs and shared game scripts', () => {
|
|
113
|
+
test('shared multi-part scripts are left alone; ordinary effects still get knobs', async () => {
|
|
114
|
+
const { liftKnobsInDoc, isSharedPartScript } = await import('../effectKnobs');
|
|
115
|
+
const shared = "var GAME = { part: 'sky' };\nfunction render(ctx, env) { ctx.lineWidth = 3.4; ctx.globalAlpha = 0.6; }";
|
|
116
|
+
const plain = "function render(ctx, env) { ctx.lineWidth = 3.4; ctx.globalAlpha = 0.6; }";
|
|
117
|
+
expect(isSharedPartScript(shared)).toBe(true);
|
|
118
|
+
expect(isSharedPartScript(plain)).toBe(false);
|
|
119
|
+
const doc: any = { objects: [
|
|
120
|
+
{ id: 'a', name: 'Sky', style: { effects: [{ type: 'CustomEffect', code: shared }] } },
|
|
121
|
+
{ id: 'b', name: 'Glow', style: { effects: [{ type: 'CustomEffect', code: plain }] } },
|
|
122
|
+
] };
|
|
123
|
+
liftKnobsInDoc(doc);
|
|
124
|
+
expect(doc.objects[0].style.effects[0].code).toBe(shared);
|
|
125
|
+
expect(doc.objects[1].style.effects[0].code).not.toBe(plain);
|
|
126
|
+
});
|
|
127
|
+
});
|