Border quality lab
Compare stroke widths, shape outlines, joins, transparency and motion
A reproducible scene collection for investigating border quality. Each sample uses the current renderer. Pause and scrub the players to compare specific frames; the code below each player exposes all dimensions and paint settings.
Widths and shapes
Thirty stationary samples: six stroke widths (0.5, 1, 2, 4, 8 and 16 scene units) across rectangles, circles, ellipses, closed paths and diagonal lines. Every sample has a transparent fill and the same opaque stroke color.
import * as Effect from "effect/Effect";import * as Color from "effect-motion/Color";import * as Entity from "effect-motion/Entity";import * as Motion from "effect-motion/Motion";import * as Scene from "effect-motion/Scene";const ink = Color.hex("#e7edf5");const muted = Color.hex("#9baabe");const noFill = Color.rgba(0, 0, 0, 0);const widths = [0.5, 1, 2, 4, 8, 16];const label = Effect.fnUntraced(function* ( text: string, x: number, y: number, fontSize = 22,) { yield* Scene.instantiate("Text", { text, position: Entity.vec3({ x, y }), fontSize, textAnchor: "middle", fillColor: muted, });});/** A stationary baseline: identical extents and paint, only width changes. */export const scene = Scene.make( "border quality — widths and shapes", function* () { yield* label("BORDER QUALITY / WIDTHS & SHAPES", 0, 420, 30); yield* label("strokeWidth in scene units", 80, 375); for (const [row, name] of [ "Rect", "Circle", "Ellipse", "Closed Path", "Diagonal Line", ].entries()) { yield* label(name, -530, 230 - row * 145, 20); } for (const [column, strokeWidth] of widths.entries()) { const x = -350 + column * 175; const paint = { fillColor: noFill, strokeColor: ink, strokeWidth }; yield* label(String(strokeWidth), x, 325, 26); yield* Scene.instantiate("Rect", { ...paint, position: Entity.vec3({ x, y: 230 }), width: 110, height: 74, }); yield* Scene.instantiate("Circle", { ...paint, position: Entity.vec3({ x, y: 85 }), radius: 42, }); yield* Scene.instantiate("Ellipse", { ...paint, position: Entity.vec3({ x, y: -60 }), radiusX: 58, radiusY: 28, }); // Same dimensions as Rect, through the Path renderer. The close // seam is at the top-left, where the first M starts. yield* Scene.instantiate("Path", { ...paint, position: Entity.vec3({ x, y: -205 }), commands: [ { _tag: "M", x: -55, y: 37 }, { _tag: "L", x: 55, y: 37 }, { _tag: "L", x: 55, y: -37 }, { _tag: "L", x: -55, y: -37 }, { _tag: "Z" }, ], }); yield* Scene.instantiate("Line", { position: Entity.vec3({ x, y: -350 }), start: Entity.vec3({ x: -55, y: -30 }), end: Entity.vec3({ x: 55, y: 30 }), strokeColor: ink, strokeWidth, }); } yield* Motion.wait("2 seconds"); }, { width: 1920, height: 1080, backgroundColor: Color.hex("#151b26") },);- Compare Rect with Closed Path: both describe the same 110 × 74 outline.
- Inspect corners for gaps or bulges, and curves for visible straight segments.
- The closed path starts at its top-left corner: inspect that closure seam.
- Compare thin horizontal, vertical and diagonal edges for uneven coverage.
Joins, transparency and motion
Six cases isolate conditions that can make artifacts easier to see. The top row stays still; each animated sample in the bottom row has a stationary reference.
import * as Effect from "effect/Effect";import * as Color from "effect-motion/Color";import * as Entity from "effect-motion/Entity";import * as Motion from "effect-motion/Motion";import * as Scene from "effect-motion/Scene";const ink = Color.hex("#e7edf5");const darkInk = Color.hex("#26364b");const noFill = Color.rgba(0, 0, 0, 0);const label = Effect.fnUntraced(function* ( text: string, x: number, y: number, fillColor = ink,) { yield* Scene.instantiate("Text", { text, position: Entity.vec3({ x, y }), fontSize: 22, textAnchor: "middle", fillColor, });});/** Six isolated stress cases; all motion is deterministic and scrub-able. */export const scene = Scene.make( "border quality — joins, alpha and motion", function* () { const camera = yield* Scene.instantiate("Camera", { position: Entity.vec3({ z: 1000 }), focalLength: 1000, }); yield* Scene.setCamera(camera); yield* label("BORDER QUALITY / STRESS CASES", 0, 430); // Paint order keeps all panels behind the later examples at z=0. for (const y of [220, -190]) { for (const x of [-470, 0, 470]) { yield* Scene.instantiate("Rect", { position: Entity.vec3({ x, y }), width: 440, height: 360, fillColor: x === 0 ? Color.hex("#eef1f5") : Color.hex("#202b3b"), strokeColor: noFill, }); } } yield* label("01 / ALPHA & FILL", -470, 350); for (const [index, alpha] of [1, 0.5].entries()) { const x = -575 + index * 210; yield* Scene.instantiate("Rect", { position: Entity.vec3({ x, y: 225 }), width: 120, height: 100, fillColor: Color.hex("#456889"), strokeColor: Color.rgba(231, 237, 245, alpha), strokeWidth: 24, }); yield* label(`stroke alpha ${alpha}`, x, 115); } yield* label("02 / ACUTE JOINS & CLOSURE", 0, 350, darkInk); for (const [index, alpha] of [1, 0.5].entries()) { const x = -105 + index * 210; yield* Scene.instantiate("Path", { position: Entity.vec3({ x, y: 220 }), fillColor: noFill, strokeColor: Color.rgba(38, 54, 75, alpha), strokeWidth: 20, commands: [ { _tag: "M", x: 0, y: 65 }, { _tag: "L", x: 55, y: -45 }, { _tag: "L", x: -55, y: -45 }, { _tag: "Z" }, ], }); yield* label(`stroke alpha ${alpha}`, x, 115, darkInk); } yield* label("03 / SMALL RADII, 8-UNIT STROKE", 470, 350); for (const [index, radius] of [4, 12, 40].entries()) { const x = 340 + index * 130; yield* Scene.instantiate("Circle", { position: Entity.vec3({ x, y: 220 }), radius, fillColor: noFill, strokeColor: ink, strokeWidth: 8, }); yield* label(`r = ${radius}`, x, 115); } yield* label("04 / SUBPIXEL MOTION, WIDTH 1", -470, -60); yield* label("05 / ROTATION, WIDTH 4", 0, -60, darkInk); yield* label("06 / PERSPECTIVE TILT, WIDTH 8", 470, -60); const motions = []; for (const [column, center] of [-470, 0, 470].entries()) { for (const [index, name] of ["reference", "animated"].entries()) { const x = center - 105 + index * 210; const rect = yield* Scene.instantiate("Rect", { position: Entity.vec3({ x, y: -185 }), width: 110, height: 110, fillColor: noFill, strokeColor: column === 1 ? darkInk : ink, strokeWidth: column === 0 ? 1 : column === 1 ? 4 : 8, }); yield* label(name, x, -300, column === 1 ? darkInk : ink); if (index === 1) { motions.push( column === 0 ? Motion.moveTo( rect, { x: x + 1, y: -184 }, "4 seconds", "linear", ) : Motion.drive(rect, "4 seconds", "linear", (t, data) => ({ ...data, rotation: Entity.vec3( column === 1 ? { z: (t * Math.PI) / 4 } : { y: (t * Math.PI) / 3 }, ), })), ); } } } yield* label( "0–2 s: hold / 2–6 s: move 1 unit, rotate 45°, tilt 60° / 6–8 s: hold", 0, -390, ); yield* Motion.wait("2 seconds"); yield* Scene.all(motions); yield* Motion.wait("2 seconds"); }, { width: 1920, height: 1080, backgroundColor: Color.hex("#151b26") },);| Case | What to inspect |
|---|---|
| Alpha and fill | A 24-unit border over an opaque fill, at stroke alpha 1 and 0.5. Look for darker or brighter joins and fill/stroke seams. |
| Acute joins and closure | Closed triangles on a light background, with a 20-unit stroke at alpha 1 and 0.5. The closure is at the top tip. |
| Small radii | Circles of radius 4, 12 and 40 with the same 8-unit stroke. Inspect the hole, silhouette and curved edges. |
| Subpixel motion | A 1-unit border translates by exactly 1 scene unit on both axes over four seconds. Look for shimmer and sudden coverage changes. |
| Rotation | A 4-unit rectangle border rotates from 0° to 45°. Compare edge thickness and corners with the fixed reference. |
| Perspective tilt | An 8-unit rectangle border tilts from 0° to 60° around Y. Compare near/far edges and joins. |
Timeline: hold for 0–2 seconds, animate during 2–6 seconds, then hold until 8 seconds. Scrub to 2, 4 and 6 seconds for the initial, midpoint and final states.
Comparing observations
The embedded players scale to the page. A scene unit is not necessarily a screen pixel: browser zoom, device pixel ratio and player size all affect apparent sharpness. Compare at the same player size and zoom. For closer inspection, increase browser zoom or render the scene at its declared resolution. Judge visual quality rather than byte-for-byte pixel equality.
When recording a finding, include the case, width, timestamp, browser, zoom and display scale. This separates stable join/geometry defects from changes caused by display scaling and antialiasing.
Paint order and embedded surfaces
The width and stress scenes use the default paint mode: all backgrounds and outlines share z=0, and later children paint on top. No background depth offsets are needed.
import * as Effect from "effect/Effect";import * as Color from "effect-motion/Color";import * as Entity from "effect-motion/Entity";import * as Motion from "effect-motion/Motion";import * as Scene from "effect-motion/Scene";const white = Color.hex("#e7edf5");const clear = Color.transparent;const label = (text: string, x: number, y: number) => Scene.instantiate("Text", { text, position: Entity.vec3({ x, y }), fontSize: 28, fillColor: white, textAnchor: "middle", });const card = Effect.fnUntraced(function* ( x: number, y: number, title: string, tilted = false,) { const group = yield* Scene.instantiate("Group", { compositing: "paint", position: Entity.vec3({ x, y }), rotation: Entity.vec3({ y: tilted ? 0.4 : 0 }), children: [ Scene.instantiate("Rect", { width: 380, height: 230, fillColor: Color.hex("#293b50"), strokeWidth: 8, strokeColor: white, }), Scene.instantiate("Circle", { position: Entity.vec3({ x: -45 }), radius: 75, fillColor: Color.hex("#33a6b8"), strokeColor: clear, }), Scene.instantiate("Circle", { position: Entity.vec3({ x: 45 }), radius: 75, fillColor: Color.hex("#f19155"), strokeColor: clear, }), label(title, 0, 70), ], }); return group;});export const scene = Scene.make( "paint order — surfaces in a depth scene", function* () { yield* label("PAINT ORDER / ALL PANEL CHILDREN AT Z = 0", 0, 440); const ordered = yield* card(-580, 200, "sibling reorder"); const faded = yield* card(0, 200, "group opacity 0.5"); yield* Scene.update(faded, (data) => ({ ...data, opacity: 0.5 })); yield* card(580, 200, "tilted paint surface", true); // A farther object is visible through the outline's transparent center. yield* Scene.instantiate("Rect", { position: Entity.vec3({ x: -580, y: -210, z: -30 }), width: 240, height: 130, fillColor: Color.hex("#33a6b8"), strokeColor: clear, }); yield* Scene.instantiate("Group", { compositing: "paint", position: Entity.vec3({ x: -580, y: -210 }), children: [ Scene.instantiate("Rect", { width: 330, height: 190, fillColor: clear, strokeColor: white, strokeWidth: 14, }), ], }); yield* label("transparent hole", -580, -370); // Reverse authoring order: the nearer orange object must still win. for (const [x, reverse] of [ [0, false], [580, true], ] as const) { for (const near of reverse ? [true, false] : [false, true]) { yield* Scene.instantiate("Rect", { position: Entity.vec3({ x: x + (near ? 30 : -30), y: -210, z: near ? 30 : -30, }), width: 180, height: 150, fillColor: Color.hex(near ? "#f19155" : "#33a6b8"), strokeColor: clear, }); } yield* label( reverse ? "depth / near authored first" : "depth / near authored last", x, -370, ); } yield* Motion.wait("2 seconds"); yield* Scene.update(ordered, (data) => { const [background, a, b, text] = data.children; return background !== undefined && a !== undefined && b !== undefined && text !== undefined ? { ...data, children: [background, b, a, text] } : data; }); yield* Motion.wait("2 seconds"); }, { width: 1920, height: 1080, compositing: "depth", backgroundColor: Color.hex("#151b26"), },);This depth scene contains explicit paint groups. At 2 seconds the left panel swaps its overlapping circles without recreating them. The center panel applies opacity once to the completed group. The right panel tilts the whole surface. Below, an outlined group preserves its transparent hole, and two depth controls keep the nearer orange object in front despite reversed authoring order.
Use Scene.make(generator, { compositing: "depth" }) for physical world
occlusion. Use Scene.instantiate("Group", { compositing: "paint", children })
for a flat panel inside it. Plain groups inherit the enclosing mode; paint groups
use content bounds and apply their position, rotation, scale and opacity once.
Nested Scene.play compositions retain the child scene's declared mode and bounds.
One opacity application per stroke
import * as Color from "effect-motion/Color";import * as Entity from "effect-motion/Entity";import * as Motion from "effect-motion/Motion";import * as Scene from "effect-motion/Scene";const ink = Color.hex("#e7edf5");const label = (text: string, x: number, y: number) => Scene.instantiate("Text", { text, position: Entity.vec3({ x, y }), fontSize: 23, textAnchor: "middle", fillColor: ink, });export const scene = Scene.make( "stroke union — one paint versus separate entities", function* () { yield* label("STROKE COVERAGE / JOINS, CROSSINGS AND RETRACING", 0, 480); const names = [ "triangle", "filled rectangle", "self crossing", "two subpaths", "retraced", "two entities", ]; for (const [row, name] of names.entries()) yield* label(name, -810, 325 - row * 130); for (const [column, alpha] of [0, 0.25, 0.5, 0.75, 1].entries()) { const x = -520 + column * 290; yield* label(`alpha ${alpha}`, x, 415); const paint = { strokeColor: Color.rgba(231, 237, 245, alpha), strokeWidth: 18, fillColor: Color.transparent, }; for (let row = 0; row < 6; row++) { const y = 335 - row * 130; if (row === 1) { yield* Scene.instantiate("Rect", { ...paint, position: Entity.vec3({ x, y }), width: 110, height: 75, fillColor: Color.hex("#456889"), }); continue; } if (row === 5) { for (const sign of [-1, 1]) yield* Scene.instantiate("Line", { ...paint, position: Entity.vec3({ x, y }), start: Entity.vec3({ x: -50, y: -35 * sign }), end: Entity.vec3({ x: 50, y: 35 * sign }), }); continue; } const commands: [Entity.PathCommand, ...Array<Entity.PathCommand>] = row === 0 ? [ { _tag: "M", x: 0, y: 40 }, { _tag: "L", x: 50, y: -35 }, { _tag: "L", x: -50, y: -35 }, { _tag: "Z" }, ] : row === 2 ? [ { _tag: "M", x: -50, y: -35 }, { _tag: "L", x: 50, y: 35 }, { _tag: "L", x: -50, y: 35 }, { _tag: "L", x: 50, y: -35 }, { _tag: "Z" }, ] : row === 3 ? [ { _tag: "M", x: -50, y: -35 }, { _tag: "L", x: 50, y: 35 }, { _tag: "M", x: -50, y: 35 }, { _tag: "L", x: 50, y: -35 }, ] : [ { _tag: "M", x: -50, y: 0 }, { _tag: "L", x: 50, y: 0 }, { _tag: "L", x: -50, y: 0 }, ]; yield* Scene.instantiate("Path", { ...paint, position: Entity.vec3({ x, y }), commands, }); } } yield* Motion.wait("2 seconds"); }, { width: 1920, height: 1080, backgroundColor: Color.hex("#202b3b") },);Each column uses one stroke alpha. Joins, closure, self-crossings, retracing and multiple subpaths of the same Path contribute to a single painted region. The last row deliberately uses two separate Line entities, so its crossing blends twice. The rectangle's inner and outer border blend over different backgrounds.
This applies to Rect, Circle, Ellipse and constant-local-z Line/Path strokes, including planar content tilted in a depth scene. Nonplanar 3D lines retain their per-point depth behavior. Color and opacity fades reuse the retained coverage.
Fractional coverage and output scale
import * as Color from "effect-motion/Color";import * as Entity from "effect-motion/Entity";import * as Motion from "effect-motion/Motion";import * as Scene from "effect-motion/Scene";const ink = Color.hex("#e7edf5");const widths = [0, 0.25, 0.5, 0.75, 1, 1.5, 2];const label = (text: string, x: number, y: number) => Scene.instantiate("Text", { text, position: Entity.vec3({ x, y }), fontSize: 23, textAnchor: "middle", fillColor: ink, });const makeCase = (mode: "paint" | "depth", grouped: boolean) => Scene.make( `subpixel strokes / ${grouped ? "paint groups in depth" : mode}`, function* () { yield* label( `FRACTIONAL STROKES / ${grouped ? "PAINT GROUPS IN DEPTH" : mode.toUpperCase()} / 1920 × 1080`, 0, 480, ); yield* label( "Native DPR 1: one scene unit = one device pixel. Each cell: rectangle / diagonal / circle.", 0, 435, ); const moving = yield* Scene.instantiate("Group", {}); for (const [column, strokeWidth] of widths.entries()) { const x = -690 + column * 230; yield* label(`width ${strokeWidth}`, x, 375); for (const [row, offset] of [0, 0.25, 0.5, 0.75].entries()) { const y = 285 - row * 145; if (column === 0) yield* label(`Δ x,y ${offset}`, -890, y); const paint = { strokeWidth, strokeColor: ink, fillColor: Color.transparent, }; const group = yield* Scene.instantiate("Group", { compositing: grouped ? "paint" : "inherit", position: Entity.vec3({ x: x + offset, y: y + offset }), children: [ Scene.instantiate("Rect", { ...paint, position: Entity.vec3({ x: -65 }), width: 48, height: 48, }), Scene.instantiate("Line", { ...paint, start: Entity.vec3({ x: -22, y: -24 }), end: Entity.vec3({ x: 22, y: 24 }), }), Scene.instantiate("Circle", { ...paint, position: Entity.vec3({ x: 65 }), radius: 24, }), ], }); yield* Scene.appendChild(moving, group); } } const sweep = yield* Scene.instantiate("Rect", { position: Entity.vec3({ y: -330 }), width: 160, height: 85, fillColor: Color.transparent, strokeColor: ink, strokeWidth: 0.25, }); yield* label( "Width sweep 0.25 → 1.5. Matrix translates exactly (1, 1) over four seconds.", 0, -420, ); yield* Motion.wait("1 second"); yield* Scene.all([ Motion.moveTo(moving, { x: 1, y: 1 }, "4 seconds", "linear"), Motion.tweenTo(sweep, { strokeWidth: 1.5 }, "4 seconds", "linear"), ]); yield* Motion.wait("1 second"); }, { width: 1920, height: 1080, compositing: mode, backgroundColor: Color.hex("#202b3b"), }, );export const scene = makeCase("paint", false);export const depthScene = makeCase("depth", false);export const groupedScene = makeCase("depth", true);Widths 0, 0.25, 0.5, 0.75, 1, 1.5 and 2 cross offsets 0, 0.25, 0.5 and 0.75 on both axes. Each cell contains horizontal/vertical rectangle edges, a diagonal and a circle. Width zero is intentionally empty. After one second, the matrix moves by exactly (1, 1) over four seconds while the lower rectangle's width changes from 0.25 to 1.5. Inspect 1, 2, 3, 4 and 5 seconds.
At native 1920×1080 output and DPR 1, scene units equal device pixels. At DPR 2, each scene unit spans two device pixels. The Player uses native display DPR, but its CSS size still scales the finished image to fit this page. A faint subpixel line may become much fainter when a 1920-wide image is reduced to a narrow player; compare exported native images before diagnosing coordinate rounding.
The same fixture is available as subpixel-grouped (paint groups in a depth
scene) and subpixel-depth (direct planar depth strokes). Their authored geometry
and projected size match the root paint case. Edge softness may change with pixel
phase; complete edges should remain continuous. Coverage masks are supersampled
and filtered before compositing, with the same multisampling policy on paint
surfaces and the final scene render.
Paint groups in a depth scene
/** Same authored matrix, isolated paint groups in a depth scene. */export { groupedScene as scene } from "./subpixel-strokes.scene";Direct planar depth strokes
/** Same authored matrix, direct planar strokes in a depth scene. */export { depthScene as scene } from "./subpixel-strokes.scene";