# Fit the frame. Keep the shape.

Independent article case study. Domain: website consumer / Design Engineering presentation.

The CPU calculates image and plane aspect-ratio fitting only when its dimension inputs change. A simple texture sampler consumes the derived UV scale and anchor offset. Cover and contain share one fit calculation with zero-size guards; a collapse animation updates only the changing plane dimension.

## Attribution and evidence

Studied: [Replicating CSS Object-Fit in WebGL: Optimized Techniques for Image Scaling and Positioning](https://tympanus.net/codrops/2025/03/11/replicating-css-object-fit-in-webgl/), Nicolas Giannantonio. Article SHA-256: 21534b88f597ccbb57e269b70578664ecb8cc1444a78d4c7ba9eb70ce7a21327. Analysis SHA-256: e53a956ec2d0a2101b6610dc5e6abb4e88b3d79c9cea1635bcfb831633e3fb74. Source revision: e954a6b544dc4a7a88592667e62a59a42a0da9f26fad763b9abefc2e47b8a005. The revision hashes the article/analysis hashes, the analyst principle and code-block evidence references; it identifies studied evidence, not a claim that the original demo executes.

Original acquisition: unresolved. Original license: unverified. originalSourceAcquired: false. Nine public JavaScript/shader fragments explain image fitting, but no complete article-specific runnable project or source entry was found.

No original article prose, code, artwork, source project or screenshot is distributed here. The authored-code MIT notice applies only to the independent implementation. The article contains partial class/update helpers; author their scaffold independently. Verify extreme portrait/landscape ratios and zero-size handling before calling the result complete.

## Initial state and controls

A generated test image keeps its circles round as the plane changes shape. Compare cover with contain, move the crop anchor, and inspect the scale values sent to the shader.

The page starts stationary. Play motion, where present, advances this study’s presentation until paused; text, bounce, portrait, orbit, strand and mascot motion loops, while the event composer stops at its endpoint. Scroll studies advance through ordinary document scroll or their chapter buttons. Static view stops time-based motion; manual controls still inspect values. The three scroll studies instead show every chapter in ordinary reading flow. Pointer parallax centers its decorative layers.

Initial control values:

| Control key | Value |
| --- | --- |
| plane | 1.5 |
| image | 1.8 |
| fit | cover |
| anchorX | 50 |
| anchorY | 50 |
| axis | width |
| open | 100 |

## Running and editing

Open index.html directly. It contains all runtime code and visuals and needs no package install, account, network, remote asset or browser-origin storage. Edit its inline style and script to change the downloaded page. styles.css and script.js are reference copies of the inline source; changing those copies alone does not change the running page. Repository regeneration overwrites index.html and all generated copies, including any manual edits. Keep a separate copy when editing a download. The repository authoring modules in vendor/codrops-article-studies/scenes-*.mjs and runtime.mjs regenerate these copies through node scripts/build-codrops-article-studies.mjs. Repository regeneration also needs the private source evidence; downloaded-page execution does not.

## Verification boundary

This generation passed the captured article/analysis hash checks, exact ID membership, local canonical Markdown anchor/hash checks, implementation-symbol checks, JavaScript parsing, semantic main/title counts, duplicate-ID checks and runtime URL/storage exclusion. The manifest codeFiles entries identify every emitted file by SHA-256. Each code symbol is a searchable named function, not a claimed executed call trace. Proposed checks are in KNOWLEDGE.json. runtime_verified: false. SG artifact capture proves only a recorded initial render; no interactive runtime, keyboard, accessibility, comfort or performance result is claimed.

Manual Chrome interaction is blocked by extension UI in this session. No alternate browser-control route was used. Preview sizing is native responsive width. Initial-render captures are tracked separately at site/artifacts/full-import/preview-posters/index.json and site/artifacts/full-import/preview-posters/visual-review.json in the repository. No capture receipt is bundled with this download. The bounded initial-render matrix requests all 21 studies at 320 pixels and three representative studies at 1280 pixels; the separate poster surface is 640 × 420. The authored CSS also adapts at 375 and 768 pixels, without claiming those widths were captured. A width request does not mean that capture exists or passed. Motion starts on explicit playback; system reduced motion and the Static view switch stop it.

consumer_reference: consumer-reference/agent-native/registry.json
