Lab

Before / after

Slant / Components

A draft and its render of one pixel hillside, one over the other, with a seam to drag, press to, or move with the keys, and a reset.

The theme follows the link: share a page with ?theme=moon.

Usage

  • <Compare before after> lays the before side over the after side and clips it at the seam; beforeLabel and afterLabel name the corner captions, and aspectRatio sizes the frame.
  • Both sides are one inline SVG scene drawn twice from the same data: pencil greys for the draft, the chart colours for the render, so it restyles with the theme. The seam is controlled here, for the readout and Reset.

Keyboard

← / →move the seam a step the way the arrow points
↑ / ↓grow or shrink the draft a step
Page Up / Page Downmove it ten steps
Home / Endshow all of the render, or all of the draft
Tabmoves from the seam to Reset

Accessibility

  • The seam's grip is a slider named "Draft and render", whose value text says how much of each side shows ("60% Draft, 40% Render").
  • Both pictures are imgs with their own names; the corner captions are hidden from assistive technology, since the value text names both sides. Reset says what it did through a polite live region.

Before / after in React and SwiftUI.

Source

The React tab is the component’s real source; the SwiftUI tab is its twin in TUTTNKit.