{
  "id": "mui_orbit_border",
  "name": "Orbit Border",
  "width": 800,
  "height": 520,
  "cornerRadius": 0,
  "fit": "Layout",
  "backgroundColor": "#09080a",
  "opacity": 1,
  "x": -400,
  "y": -260,
  "responsive": {
    "enabled": true,
    "mode": "constraint",
    "width": {
      "type": "fixed"
    },
    "height": {
      "type": "fixed"
    },
    "maintainAspectRatio": false,
    "scaleObjects": false,
    "breakpoints": [
      {
        "id": "bp_mobile",
        "name": "Mobile",
        "minWidth": 0,
        "maxWidth": 599
      },
      {
        "id": "bp_tablet",
        "name": "Tablet",
        "minWidth": 600,
        "maxWidth": 1023
      },
      {
        "id": "bp_desktop",
        "name": "Desktop",
        "minWidth": 1024
      }
    ]
  },
  "layoutProps": {
    "mode": "linear",
    "direction": "vertical",
    "gap": 0,
    "padding": {
      "top": 0,
      "right": 0,
      "bottom": 0,
      "left": 0
    },
    "alignItems": "stretch",
    "layoutSizingHorizontal": "fixed",
    "layoutSizingVertical": "fixed"
  },
  "seo": {
    "title": "Orbit Border — Exode Motion UI",
    "description": "A feature card with two beams of light orbiting its border and a spotlight that follows the cursor inside."
  },
  "stateMachine": {
    "inputs": [
      {
        "id": "in_eyebrow",
        "name": "eyebrow",
        "value": {
          "type": "Text",
          "value": "Realtime",
          "defaultValue": "Realtime"
        }
      },
      {
        "id": "in_title",
        "name": "title",
        "value": {
          "type": "Text",
          "value": "Ship motion that reacts to your users",
          "defaultValue": "Ship motion that reacts to your users"
        }
      },
      {
        "id": "in_body",
        "name": "body",
        "value": {
          "type": "Text",
          "value": "State machines, inputs and physics run in one tiny runtime. No video, no lag, every frame live.",
          "defaultValue": "State machines, inputs and physics run in one tiny runtime. No video, no lag, every frame live."
        }
      },
      {
        "id": "in_cta",
        "name": "cta",
        "value": {
          "type": "Text",
          "value": "Explore the runtime",
          "defaultValue": "Explore the runtime"
        }
      },
      {
        "id": "in_speed",
        "name": "speed",
        "value": {
          "type": "Number",
          "value": 1,
          "defaultValue": 1
        }
      },
      {
        "id": "in_radius",
        "name": "radius",
        "value": {
          "type": "Number",
          "value": 22,
          "defaultValue": 22
        }
      },
      {
        "id": "in_accent",
        "name": "accent",
        "value": {
          "type": "Text",
          "value": "#ffb84d",
          "defaultValue": "#ffb84d"
        }
      },
      {
        "id": "in_accent2",
        "name": "accent2",
        "value": {
          "type": "Text",
          "value": "#ff5e7e",
          "defaultValue": "#ff5e7e"
        }
      },
      {
        "id": "in_text",
        "name": "text",
        "value": {
          "type": "Text",
          "value": "#f6f1ea",
          "defaultValue": "#f6f1ea"
        }
      },
      {
        "id": "in_bg",
        "name": "bg",
        "value": {
          "type": "Text",
          "value": "#09080a",
          "defaultValue": "#09080a"
        }
      }
    ],
    "layers": [
      {
        "name": "Base",
        "entryStateId": "s_idle",
        "states": [
          {
            "id": "s_idle",
            "name": "Idle",
            "loop": true,
            "transitions": []
          }
        ]
      }
    ],
    "logicNodes": []
  },
  "animations": [],
  "physics": {
    "enabled": false,
    "gravity": {
      "x": 0,
      "y": 9.8
    }
  },
  "animationFlow": [],
  "navigation": [],
  "stateVariables": [],
  "objects": [
    {
      "id": "stage",
      "name": "Stage",
      "type": "Group",
      "transform": {
        "x": 0,
        "y": 0,
        "rotation": 0,
        "scale_x": 1,
        "scale_y": 1,
        "opacity": 1,
        "skew_x": 0,
        "skew_y": 0
      },
      "width": 800,
      "height": 520,
      "geometry": {
        "type": "Rectangle",
        "width": 800,
        "height": 520,
        "cornerRadius": 0
      },
      "cornerRadius": 0,
      "children": [],
      "clipContent": true,
      "style": {
        "fill": {
          "type": "Solid",
          "color": "#09080a",
          "opacity": 1
        },
        "effects": [
          {
            "id": "fx_orbit-border",
            "type": "CustomEffect",
            "name": "Orbit Border",
            "isEnabled": true,
            "params": {},
            "code": "/* Shared by every motion-ui effect (prepended to each one).\n   Rules for this file and the effects: the .bexode compiler minifies effect\n   code, so use explicit semicolons, block comments only, and never write a\n   minus followed by a negative value (it collapses to a decrement). */\n\n/* Read a live state-machine input, falling back to a default. */\nfunction inp(env, name, fallback) {\n  const v = env.inputs ? env.inputs[name] : undefined;\n  if (v === undefined || v === null || v === '') return fallback;\n  if (typeof fallback === 'number') {\n    const n = Number(v);\n    return isFinite(n) ? n : fallback;\n  }\n  if (typeof fallback === 'boolean') return v === true || v === 1 || v === 'true';\n  return v;\n}\n\n/* '#rgb' / '#rrggbb' to [r, g, b]; anything else falls back to white. */\nfunction rgbOf(hex) {\n  let h = String(hex || '').trim().replace('#', '');\n  if (h.length === 3) h = h[0] + h[0] + h[1] + h[1] + h[2] + h[2];\n  if (!/^[0-9a-fA-F]{6}$/.test(h)) return [255, 255, 255];\n  const n = parseInt(h, 16);\n  return [(n >> 16) & 255, (n >> 8) & 255, n & 255];\n}\n\nfunction rgba(hex, a) {\n  const c = rgbOf(hex);\n  return 'rgba(' + c[0] + ',' + c[1] + ',' + c[2] + ',' + Math.max(0, Math.min(1, a)) + ')';\n}\n\nfunction mix(a, b, t) {\n  const x = rgbOf(a), y = rgbOf(b);\n  const r = Math.round(x[0] + (y[0] - x[0]) * t);\n  const g = Math.round(x[1] + (y[1] - x[1]) * t);\n  const bl = Math.round(x[2] + (y[2] - x[2]) * t);\n  return '#' + ((1 << 24) + (r << 16) + (g << 8) + bl).toString(16).slice(1);\n}\n\n/* A soft round glow, rendered once per colour and blitted with drawImage\n   (much cheaper than shadowBlur on every particle). */\nconst __glows = {};\nfunction glowSprite(hex) {\n  if (__glows[hex]) return __glows[hex];\n  const s = 64;\n  const c = document.createElement('canvas');\n  c.width = s; c.height = s;\n  const g = c.getContext('2d');\n  const gr = g.createRadialGradient(s / 2, s / 2, 0, s / 2, s / 2, s / 2);\n  gr.addColorStop(0, rgba(hex, 1));\n  gr.addColorStop(0.18, rgba(hex, 0.55));\n  gr.addColorStop(0.45, rgba(hex, 0.14));\n  gr.addColorStop(1, rgba(hex, 0));\n  g.fillStyle = gr;\n  g.fillRect(0, 0, s, s);\n  __glows[hex] = c;\n  return c;\n}\n\nfunction glow(ctx, hex, x, y, r, a) {\n  if (r <= 0 || a <= 0) return;\n  ctx.globalAlpha = Math.min(1, a);\n  ctx.drawImage(glowSprite(hex), x - r, y - r, r * 2, r * 2);\n  ctx.globalAlpha = 1;\n}\n\n/* Frame clock: seconds since start and a clamped delta. */\nfunction tick(S) {\n  const now = performance.now();\n  if (!S.t0) { S.t0 = now; S.last = now; }\n  S.dt = Math.min(0.05, Math.max(0.001, (now - S.last) / 1000));\n  S.last = now;\n  S.age = (now - S.t0) / 1000;\n  return S.dt;\n}\n\n/* Deterministic pseudo-random so layouts are stable across resizes. */\nfunction rng(seed) {\n  let s = seed >>> 0 || 1;\n  return function () {\n    s = (s * 1664525 + 1013904223) >>> 0;\n    return s / 4294967296;\n  };\n}\n\nfunction ease(x) { return x < 0.5 ? 4 * x * x * x : 1 + (Math.pow(2 * x - 2, 3)) / 2; }\nfunction clamp(v, a, b) { return v < a ? a : v > b ? b : v; }\n\nconst SANS = 'Inter, Helvetica, Arial, sans-serif';\nconst MONO = 'ui-monospace, Menlo, monospace';\n\nfunction roundRect(ctx, x, y, w, h, r) {\n  r = Math.min(r, w / 2, h / 2);\n  ctx.beginPath();\n  ctx.moveTo(x + r, y);\n  ctx.arcTo(x + w, y, x + w, y + h, r);\n  ctx.arcTo(x + w, y + h, x, y + h, r);\n  ctx.arcTo(x, y + h, x, y, r);\n  ctx.arcTo(x, y, x + w, y, r);\n  ctx.closePath();\n}\n\n/* Shared backdrop: flat colour, soft vignette and fine grain. */\nfunction backdrop(ctx, W, H, bg, tint, amt) {\n  ctx.fillStyle = bg;\n  ctx.fillRect(0, 0, W, H);\n  if (tint && amt > 0) {\n    const gr = ctx.createRadialGradient(W / 2, H * 0.45, 0, W / 2, H * 0.45, Math.max(W, H) * 0.7);\n    gr.addColorStop(0, rgba(tint, 0.10 * amt));\n    gr.addColorStop(1, rgba(tint, 0));\n    ctx.fillStyle = gr;\n    ctx.fillRect(0, 0, W, H);\n  }\n  const vg = ctx.createRadialGradient(W / 2, H / 2, Math.min(W, H) * 0.3, W / 2, H / 2, Math.max(W, H) * 0.8);\n  vg.addColorStop(0, 'rgba(0,0,0,0)');\n  vg.addColorStop(1, 'rgba(0,0,0,0.45)');\n  ctx.fillStyle = vg;\n  ctx.fillRect(0, 0, W, H);\n}\n\n/* Greedy word wrap with the current ctx.font. */\nfunction wrap(ctx, text, maxW) {\n  const out = [];\n  String(text).split('\\n').forEach(function (para) {\n    const words = para.split(' ');\n    let cur = '';\n    for (let i = 0; i < words.length; i++) {\n      const next = cur ? cur + ' ' + words[i] : words[i];\n      if (cur && ctx.measureText(next).width > maxW) { out.push(cur); cur = words[i]; } else cur = next;\n    }\n    out.push(cur);\n  });\n  return out;\n}\n\n/* Largest font size (up to max) at which text wraps into maxLines within maxW. */\nfunction fitFont(ctx, text, weight, family, maxW, maxLines, max, min) {\n  let fs = max;\n  while (fs > min) {\n    ctx.font = weight + ' ' + fs + 'px ' + family;\n    if (wrap(ctx, text, maxW).length <= maxLines) break;\n    fs = fs * 0.92;\n  }\n  ctx.font = weight + ' ' + fs + 'px ' + family;\n  return fs;\n}\n\n/* Smoothed pointer that idles along a slow figure-eight when the cursor is away. */\nfunction follow(S, env, W, H, k) {\n  const pt = env.pointer || {};\n  const t = S.age || 0;\n  const tx = pt.isHovered ? pt.localX : W / 2 + Math.sin(t * 0.37) * W * 0.3;\n  const ty = pt.isHovered ? pt.localY : H / 2 + Math.sin(t * 0.74) * H * 0.22;\n  if (S.px === undefined) { S.px = tx; S.py = ty; }\n  S.px += (tx - S.px) * Math.min(1, S.dt * (k || 6));\n  S.py += (ty - S.py) * Math.min(1, S.dt * (k || 6));\n  S.inside = !!pt.isHovered;\n  return pt;\n}\n\n/* Optional centred headline over a background effect. */\nfunction title(ctx, W, H, text, sub, ink, accent, bg) {\n  if (!text) return;\n  if (bg) {\n    /* Soft scrim so the headline reads over busy motion. */\n    const sc = ctx.createRadialGradient(W / 2, H / 2, 0, W / 2, H / 2, Math.min(W * 0.5, 560));\n    sc.addColorStop(0, rgba(bg, 0.72));\n    sc.addColorStop(1, rgba(bg, 0));\n    ctx.fillStyle = sc;\n    ctx.fillRect(0, 0, W, H);\n  }\n  ctx.textAlign = 'center';\n  ctx.textBaseline = 'alphabetic';\n  const maxW = Math.min(W * 0.86, 900);\n  const fs = fitFont(ctx, text, 600, SANS, maxW, 2, clamp(W * 0.065, 26, 72), 16);\n  const lines = wrap(ctx, text, maxW);\n  const lh = fs * 1.08;\n  const y0 = H / 2 - (lines.length * lh) / 2 + fs * 0.8 - (sub ? fs * 0.35 : 0);\n  ctx.fillStyle = ink;\n  lines.forEach(function (l, i) { ctx.fillText(l, W / 2, y0 + i * lh); });\n  if (sub) {\n    ctx.font = '500 ' + clamp(fs * 0.24, 11, 15) + 'px ' + MONO;\n    ctx.fillStyle = rgba(accent, 0.85);\n    ctx.fillText(String(sub).toUpperCase(), W / 2, y0 + (lines.length - 1) * lh + fs * 0.9);\n  }\n}\n\n/* Orbit Border: a feature card whose border carries a travelling beam of\n   light, with a spotlight that follows the cursor inside the card.\n   Inputs: eyebrow, title, body, cta, speed, radius, accent, accent2, bg, text. */\nlet S = null;\n\n/* Point at distance d along a rounded-rect perimeter (clockwise from top-left\n   straight edge). */\nfunction perim(x, y, w, h, r, d) {\n  const sw = w - 2 * r, sh = h - 2 * r, arc = Math.PI * r / 2;\n  const L = 2 * sw + 2 * sh + 4 * arc;\n  d = ((d % L) + L) % L;\n  const segs = [\n    ['l', x + r, y, 1, 0, sw], ['a', x + w - r, y + r, -Math.PI / 2, arc],\n    ['l', x + w, y + r, 0, 1, sh], ['a', x + w - r, y + h - r, 0, arc],\n    ['l', x + w - r, y + h, -1, 0, sw], ['a', x + r, y + h - r, Math.PI / 2, arc],\n    ['l', x, y + h - r, 0, -1, sh], ['a', x + r, y + r, Math.PI, arc],\n  ];\n  for (let i = 0; i < segs.length; i++) {\n    const g = segs[i];\n    const len = g[0] === 'l' ? g[5] : g[4];\n    if (d <= len) {\n      if (g[0] === 'l') return [g[1] + g[3] * d, g[2] + g[4] * d];\n      const a = g[3] + (d / Math.max(0.0001, r));\n      return [g[1] + Math.cos(a) * r, g[2] + Math.sin(a) * r];\n    }\n    d -= len;\n  }\n  return [x, y];\n}\n\nfunction render(ctx, env) {\n  const W = env.width, H = env.height;\n  if (!S) S = { hover: 0 };\n  const dt = tick(S);\n\n  const eyebrow = String(inp(env, 'eyebrow', 'Realtime'));\n  const head = String(inp(env, 'title', 'Ship motion that reacts to your users'));\n  const body = String(inp(env, 'body', 'State machines, inputs and physics run in one tiny runtime. No video, no lag, every frame live.'));\n  const cta = String(inp(env, 'cta', 'Explore the runtime'));\n  const speed = inp(env, 'speed', 1);\n  const rr = clamp(inp(env, 'radius', 22), 0, 60);\n  const A = inp(env, 'accent', '#ffb84d');\n  const B = inp(env, 'accent2', '#ff5e7e');\n  const bg = inp(env, 'bg', '#09080a');\n  const ink = inp(env, 'text', '#f6f1ea');\n\n  ctx.save();\n  ctx.translate(-W / 2, -H / 2);\n  backdrop(ctx, W, H, bg, A, 0.6);\n\n  const cw = Math.min(W - 32, 560);\n  const pad = clamp(cw * 0.08, 20, 40);\n  const tfs = clamp(cw * 0.062, 20, 34);\n  ctx.font = '600 ' + tfs + 'px ' + SANS;\n  const tl = wrap(ctx, head, cw - pad * 2);\n  const bfs = clamp(cw * 0.03, 13, 16);\n  ctx.font = '400 ' + bfs + 'px ' + SANS;\n  const bl = wrap(ctx, body, cw - pad * 2);\n  const ch = Math.min(H - 32, pad * 2 + 22 + tl.length * tfs * 1.12 + 14 + bl.length * bfs * 1.55 + 28 + bfs * 1.4);\n  const x0 = (W - cw) / 2, y0 = (H - ch) / 2;\n  const r = Math.min(rr, cw / 2, ch / 2);\n\n  const pt = env.pointer || {};\n  const over = !!pt.isHovered && pt.localX > x0 && pt.localX < x0 + cw && pt.localY > y0 && pt.localY < y0 + ch;\n  S.hover += ((over ? 1 : 0) - S.hover) * Math.min(1, dt * 6);\n  if (S.mx === undefined) { S.mx = x0 + cw * 0.3; S.my = y0; }\n  const tx = over ? pt.localX : x0 + cw * (0.5 + 0.35 * Math.sin(S.age * 0.6));\n  const ty = over ? pt.localY : y0 + ch * 0.2;\n  S.mx += (tx - S.mx) * Math.min(1, dt * 8);\n  S.my += (ty - S.my) * Math.min(1, dt * 8);\n\n  /* Card body. */\n  roundRect(ctx, x0, y0, cw, ch, r);\n  const g = ctx.createLinearGradient(x0, y0, x0, y0 + ch);\n  g.addColorStop(0, mix(bg, ink, 0.07));\n  g.addColorStop(1, mix(bg, ink, 0.025));\n  ctx.fillStyle = g;\n  ctx.fill();\n  ctx.save();\n  roundRect(ctx, x0, y0, cw, ch, r);\n  ctx.clip();\n  const sp = ctx.createRadialGradient(S.mx, S.my, 0, S.mx, S.my, cw * 0.6);\n  sp.addColorStop(0, rgba(A, 0.1 + S.hover * 0.1));\n  sp.addColorStop(1, rgba(A, 0));\n  ctx.fillStyle = sp;\n  ctx.fillRect(x0, y0, cw, ch);\n  ctx.restore();\n\n  /* Static hairline border, brighter near the cursor. */\n  roundRect(ctx, x0 + 0.5, y0 + 0.5, cw - 1, ch - 1, r);\n  ctx.strokeStyle = rgba(ink, 0.1);\n  ctx.lineWidth = 1;\n  ctx.stroke();\n  const bgr = ctx.createRadialGradient(S.mx, S.my, 0, S.mx, S.my, cw * 0.45);\n  bgr.addColorStop(0, rgba(A, 0.6 * S.hover));\n  bgr.addColorStop(1, rgba(A, 0));\n  ctx.strokeStyle = bgr;\n  ctx.stroke();\n\n  /* The orbiting beam: a fading run of points along the perimeter. */\n  const L = 2 * (cw - 2 * r) + 2 * (ch - 2 * r) + 2 * Math.PI * r;\n  const head0 = (S.age * speed * 0.22 * L) % L;\n  const trail = L * 0.22;\n  ctx.globalCompositeOperation = 'lighter';\n  for (let beam = 0; beam < 2; beam++) {\n    const hd = head0 + beam * L / 2;\n    const col = beam ? B : A;\n    const steps = 60;\n    let prev = perim(x0 + 0.5, y0 + 0.5, cw - 1, ch - 1, r, hd - trail);\n    for (let i = 1; i <= steps; i++) {\n      const f = i / steps;\n      const p = perim(x0 + 0.5, y0 + 0.5, cw - 1, ch - 1, r, hd - trail + trail * f);\n      ctx.strokeStyle = rgba(mix(col, '#ffffff', f * f * 0.5), f * f * (0.85 + S.hover * 0.15));\n      ctx.lineWidth = 1 + f * 1.2;\n      ctx.beginPath();\n      ctx.moveTo(prev[0], prev[1]);\n      ctx.lineTo(p[0], p[1]);\n      ctx.stroke();\n      prev = p;\n    }\n    glow(ctx, col, prev[0], prev[1], 26, 0.55);\n  }\n  ctx.globalCompositeOperation = 'source-over';\n\n  /* Content. */\n  ctx.textAlign = 'left';\n  ctx.textBaseline = 'alphabetic';\n  let y = y0 + pad + 12;\n  ctx.font = '500 ' + clamp(bfs * 0.78, 10, 12) + 'px ' + MONO;\n  ctx.fillStyle = A;\n  ctx.fillText(eyebrow.toUpperCase(), x0 + pad, y);\n  y += 10 + tfs;\n  ctx.font = '600 ' + tfs + 'px ' + SANS;\n  ctx.fillStyle = ink;\n  tl.forEach(function (l, i) { ctx.fillText(l, x0 + pad, y + i * tfs * 1.12); });\n  y += (tl.length - 1) * tfs * 1.12 + 14 + bfs * 1.2;\n  ctx.font = '400 ' + bfs + 'px ' + SANS;\n  ctx.fillStyle = rgba(ink, 0.62);\n  bl.forEach(function (l, i) { ctx.fillText(l, x0 + pad, y + i * bfs * 1.55); });\n  y += (bl.length - 1) * bfs * 1.55 + 28 + bfs * 0.4;\n  ctx.font = '600 ' + bfs + 'px ' + SANS;\n  ctx.fillStyle = mix(ink, A, 0.3 + S.hover * 0.7);\n  ctx.fillText(cta, x0 + pad, y);\n  const cx = x0 + pad + ctx.measureText(cta).width + 8 + S.hover * 5;\n  ctx.strokeStyle = ctx.fillStyle;\n  ctx.lineWidth = 1.6;\n  ctx.lineCap = 'round';\n  ctx.beginPath();\n  ctx.moveTo(cx, y - bfs * 0.32);\n  ctx.lineTo(cx + bfs * 0.7, y - bfs * 0.32);\n  ctx.moveTo(cx + bfs * 0.42, y - bfs * 0.6);\n  ctx.lineTo(cx + bfs * 0.7, y - bfs * 0.32);\n  ctx.lineTo(cx + bfs * 0.42, y - bfs * 0.04);\n  ctx.stroke();\n\n  ctx.restore();\n}\n"
          }
        ]
      },
      "layoutProps": {
        "layoutSizingHorizontal": "fill",
        "layoutSizingVertical": "fill"
      },
      "zIndex": 1,
      "interactions": []
    }
  ]
}
