Build · Responsive layouts
Docs / Build

Responsive layouts

Ova Motion combines a Flexbox / Grid layout engine (powered by Taffy), visual edge constraints, aspect-ratio breakpoints, and N-slicing so a single .egg file adapts cleanly to phones, tablets, foldables, desktops, and ultrawide monitors.

Live demo

Switch between 21:9, 16:9, 4:3, 1:1, and 9:16 below to watch the same artboard reflow its containers, switch breakpoints, and scale with layoutScaleFactor. Compare Fit.Layout against classic Fit.Contain letterboxing:

Active breakpoint: Base (Desktop) — click the Hero card or LIVE pill to toggle Turbo boost.Open template →

Fit modes & scale factor

Open the Screens section in the Design Inspector (with nothing selected) or click Make Responsive ▾ to choose how your artboard meets screens of any aspect ratio:

Fit modeHow the artboard adaptsBest for
Fit.LayoutArtboard takes the viewport size and reflows auto-layout containers and breakpoints live.Responsive UI, dashboards, HUDs, cards, navigation bars
Fit.ExpandFits your design along the narrow side and extends the canvas along the long side (no black bars).Full-bleed games, interactive stories, scenes
Fit.ContainScales uniformly inside the viewport and letterboxes extra space.Fixed-aspect animations, icons, hero badges
Fit.CoverScales uniformly until the entire viewport is covered, cropping overflow.Background loops, full-bleed banners
Fit.FillStretches horizontally and vertically to match the exact container box.Abstract textures, simple fills
Tip — 1-click setup: In the Design Inspector under Screens, click Make Responsive ▾ to immediately switch to Fit.Layout and generate 9:16 Portrait & 1:1 Square breakpoints, or configure full-bleed Fit.Expand for games.

When using Fit.Layout, pass layoutScaleFactor (a positive number or "auto") at runtime to scale logical artboard units — keeping typography and controls legible on tiny 320px phones and crisp on 4K ultrawide displays without manually resizing every layer.

Auto layout & scale types

Select any frame or group and press Cmd+Shift+A (or click + Add auto layout in the Inspector, or Wrap in Row / Column / Grid / Stack from the toolbar's layout menu) to switch from freeform placement to responsive Flexbox (Row / Column / Wrap), Grid, or Stack containers. Drag the pink handles on the stage to change padding and gap, click the chosen dot of the alignment grid again to spread the children out, and drag the artboard's right or bottom edge to watch the layout reflow:

Scale typeBehavior
FixedExact pixel width or height (optional Min / Max bounds).
Percent (%)Percentage of the parent container's inner size (e.g. 50% width or bar height).
FillGrows or shrinks to fill remaining space along the main or cross axis (Flex weight / Grid fr).
HugShrink-wraps tightly around its children plus padding.
Aspect ratioLocks width ÷ height (16:9, 4:3, 1:1, 9:16, or custom) on shapes, cards, and containers.

Texts in a layout are measured, not stretched: a text set to Auto height wraps at the width its box gets and grows taller to hold its lines; Auto width stays on one line. Gap and padding take points or percent of the container.

Set Animate duration (seconds) on any layout container to smoothly interpolate child positions and sizes whenever breakpoints trigger or items toggle visibility.

Constraints & safe areas

One Constraints section in the Inspector says where a layer stays when what holds it changes size. The line under its title says what that is: the screen for a layer on the artboard, its frame for a child of a frame, or its layout's sides for an absolute child of an auto layout (a child that flows in a layout has none: the layout places it):

  • Left / Right / Top / Bottom pins keep a fixed distance from the corresponding screen edge; pinning opposite edges stretches the layer across the viewport.
  • Center keeps the layer centered along that axis; Scale scales proportionally with the screen.
  • Safe area automatically respects notches, Dynamic Island, and home indicators via CSS env(safe-area-inset-*) on web and native insets on iOS / Android.
  • N-Slicing lets decorative buttons, panels, and borders stretch across any box without distorting their corners.

Aspect-ratio breakpoints

Define breakpoints in Screens → Breakpoints using shortest side (min_short / max_short) and aspect ratio (min_aspect / max_aspect). Click any breakpoint pill to edit layout direction, wrapping, padding, gaps, or collapsed layers specifically for that screen shape — and verify instantly across 10 built-in device presets (iPhone SE, 9:16 Phone, 3:4 Foldable, 1:1 Square, 4:3 iPad, 16:9 Desktop, 21:9 Ultrawide) in the Live preview window.

Runtime integration

Pass fit: "file" so the web player automatically respects each .egg file's authored responsive settings, or explicitly override fit and layoutScaleFactor:

app.tsresponsive web player
import init, * as egg from "./egg_web.js";
import { mount } from "./egg-player.js";

await init();
const bytes = new Uint8Array(await (await fetch("responsive-layout.egg")).arrayBuffer());
const view = mount(egg, canvas, bytes, {
  fit: "file",               // respects Fit.Layout / Fit.Expand baked in the .egg
  layoutScaleFactor: "auto", // or a fixed number like 1.25
});

// Switch dynamically at runtime without recreating the player:
view.setFit("layout");
view.setLayoutScale(1.2);