Skip to content

Set the red lines adrift, and make the invariant that keeps them seamless enforceable - #31

Merged
drmowinckels merged 3 commits into
mainfrom
wave-drift-animation
Nov 24, 2026
Merged

drmowinckels merged 3 commits into
mainfrom
wave-drift-animation

Conversation

@drmowinckels

Copy link
Copy Markdown
Contributor

Three commits. The first is the feature; the second and third are what the pre-merge review turned up, and are worth reading as the interesting part.

The animation

The red hairlines under the hero and above the footer now drift sideways — 32–110s per cycle, neighbouring layers in opposite directions, so the group reads as depth rather than one sliding sheet. Only transform animates.

The old paths could not be animated as they stood. Banner line 1 started at y=70 and ended at y=30, so sliding it by a tile would step at the seam. All five layers are regenerated as sines approximated one cubic per half period, and a layer loops because it is translated by exactly one period so it lands on itself, and is drawn a further period past the viewBox on the side it drifts toward so its trailing end stays out of sight.

The three wave blocks were also three copies of the same markup with #c04545 written out by hand. They are now one partial plus one stylesheet.

The invariant was split, and nothing could see it

The second half of that invariant depends on which way a layer drifts. The path data lived in the partial; the drift direction lived in the stylesheet. Nothing connected them.

Flipping one layer's direction in CSS alone leaves its line ending in mid-air 12 seconds into a 64-second cycle, widening to 1170 of 1440 units — with prettier, the content lint, the strict build, the bundle-freshness check, lychee and axe all green. A reviewer looking at a preview for ten seconds sees nothing.

So path data, drift and shift now live together in data/waves.yaml, generated by tools/gen-waves.mjs — committed this time, so the comment telling you to regenerate rather than hand-edit names a thing that exists.

tools/check-waves.mjs enforces it in the fast lint job. Every assertion was checked by breaking what it guards:

Break Result
Hand-edit a d value ✅ red
Flip a drift in the data ✅ red
Flip a --wave-shift in the CSS ✅ red
Delete the animation ✅ red
Generator drops its safety margin ✅ red
Generator's coverage formula wrong ✅ red

The reduced-motion fix was treating a symptom

The global rule collapses animation-duration to 0.01ms, which does not stop an infinite animation — it runs it flat out. The component was opting out by name to dodge that.

The global now also caps animation-iteration-count, which is the half that matters, and waves.css drops its override. The next infinite animation in this theme gets it free. Verified in-browser: under reduced motion the layers report iteration count 1 and document.getAnimations() is empty; under normal motion, 8 running animations that measurably move.

The accessibility gate could not have caught any of this. Its reduced-motion check sampled a .reveal, never a .wave, and asserted on duration — which the global pins at 0.01ms whether an animation is suppressed or spinning forever. Retargeting it would not have helped. It now asserts that nothing loops, which I confirmed by removing the global cap and watching it fail: 8 element(s) with iteration-count infinite.

Also

  • sections/cta.html has not been rendered by any layout since the landing page was cut back, so it and its variants are deleted rather than carried forward a third time.
  • will-change is gone — Blink does not give SVG children their own layer, so it bought nothing and was permanent on 5 elements across 78 pages.
  • Two keyframes collapse into one driven by --wave-shift, which lets the two short-period layers travel 720 units instead of 1440 and carry a third less geometry.
  • Layers numbered by depth instead of lettered; dead class parameter and unused default duration removed; comments cut back to the invariants not visible in the code.

Deliberate, so it is not mistaken for a slip

The hero is now monochrome. The old banner drew one lighter #E57575 hairline and the consolidation dropped it. Two reviewers flagged it; keeping it is a choice, not an oversight. The footer's two-tone is unchanged. Reverting is a one-layer swap.

Risk

Low. Presentational, plus one global CSS line and two CI assertions. The footer partial renders on every page, so the blast radius is site-wide, but the worst failure is cosmetic. No data, auth, network or file I/O. A security pass verified the partial cannot be broken out of its class attribute even via safeHTML, and that the committed CSS bundle reproduces byte-for-byte.

How to revert

git revert 7c52772 d29913b 2dd0289, then npm run build:css --prefix themes/capro-tw. Reverting only the third or second commit is safe and leaves a working animation with weaker checks. sections/cta.html and the old hand-drawn paths come back with the first revert.

Test plan

Beyond what CI proves: mobile rendering was checked at 390px and 414px, because two of the regenerated layers have two periods per viewBox and could have read as a zigzag at phone width — they do not. The mutation results in the table above and the reduced-motion browser checks are not reproduced by any CI step.

Follow-up, not in this PR

content/cta/ is now orphaned — two markdown files and a 3.9 MB JPEG with no consumer. Deleting it is content, so it is your call. Separately, this repo has no REVIEW.md or RISK_TIERS.md; review-scaffold would install one.

🤖 Generated with Claude Code

drmowinckels and others added 3 commits November 21, 2026 21:09
The waves under the hero, around the CTA band and above the footer were
three copies of the same markup, each with the brand red written out as a
hex literal. Collapse them into helpers/waves.html plus components/waves.css,
so colour and motion are each defined once, and give the layers a slow
sideways drift.

The old path data could not be animated as it stood. A wave that starts at
y=70 and ends at y=30 does not meet its own tile, so sliding it by a viewBox
width would show a step at the seam. The paths are regenerated as sines
approximated by one cubic per half period, with a whole number of periods
across the 1440-unit viewBox, which makes a layer land exactly on itself
after a 1440-unit translation. Each path is also drawn a full tile beyond
the viewBox on the side it drifts towards, so its trailing end never comes
into view. Verified in the browser: sampling y(x) against y(x +/- 1440)
across the visible width leaves at most 0.003 units, and every layer covers
its whole cycle.

Neighbouring layers drift in opposite directions at rates between 64s and
110s, so the group reads as depth rather than as one sliding sheet. Only
transform is animated, so the work stays on the compositor.

The global reduced-motion rule collapses animation-duration to 0.01ms, which
would spin an infinite loop rather than stop it, so waves.css disables the
animation by name instead.

The cta-top and cta-bottom variants are wired but currently render nowhere:
partials/sections/cta.html is not called by any layout, and was already dead
before this change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review of the drift animation turned up a set of things worth fixing before
this ships.

The invariant was split across two files. Whether a layer's path is drawn
long enough depends on which way it drifts, the path data lived in the
partial, and the drift direction lived in the stylesheet, with nothing
connecting them. Flipping one layer's direction in CSS left its line ending
in mid-air twelve seconds into a sixty-four second cycle, widening to 1170
of 1440 units, with every check still green. Path data, drift and shift now
live together in data/waves.yaml, generated by tools/gen-waves.mjs -- which
is committed this time, so the comment telling you to regenerate rather than
hand-edit now names a thing that exists.

tools/check-waves.mjs enforces all of it: the data matches a fresh
generation, each path is periodic over its own shift, each path covers the
range its direction requires, and the --wave-shift in waves.css agrees with
the data. It is in the fast lint job. Each assertion was checked by breaking
the thing it guards and confirming it goes red.

The reduced-motion override was a symptom fix. The global rule collapses
duration to 0.01ms, which does not stop an infinite animation, so the
component had to opt out by name. The global now also caps
animation-iteration-count, which is the half that matters, and waves.css
drops its override -- the next infinite animation gets this free. Confirmed
in the browser: under reduced motion the layers report iteration count 1 and
document.getAnimations() is empty.

The accessibility gate could not have caught any of this. Its reduced-motion
check sampled a .reveal, never a .wave, and asserted on duration, which the
global pins at 0.01ms whether an animation is suppressed or spinning. It now
asserts that nothing loops, which fails loudly when the global cap is
removed.

Also: sections/cta.html has not been rendered by any layout since the
landing page was cut back, so it and its two variants are deleted rather
than carried forward a third time. will-change is gone -- Blink does not
give SVG children their own layer, so it bought nothing. The two keyframes
collapse into one driven by --wave-shift, which lets the two short-period
layers travel 720 units instead of 1440 and carry a third less geometry.
Layers are numbered by depth instead of lettered, the dead class parameter
and unused default duration are gone, and the comments are cut back to the
invariants that are not visible in the code.

The hero stays monochrome. The old banner drew one lighter hairline and the
consolidation dropped it; keeping it that way is deliberate, not an
oversight. The footer's two-tone is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Quality review of the previous commit, with two findings worth acting on.

The coverage assertion imported `required` from the generator, so it checked
the generator against its own definition of what coverage means. It was also
redundant: probing x +/- shift across the visible band already covers both
halves of the invariant, because a path drawn too short has nothing to
compare against and fails as a NaN. One assertion now does the work of two,
and it depends on nothing but the tile width. Replacing the generator's
coverage formula with a wrong one still fails, which it should.

The claim that an integer number of periods is required was wrong, and it
was repeated in the data file, the partial and both commit messages. The
shift is the period, so a layer lands on itself whatever the period is --
checked by generating a layer at 1.5 periods, which stays seamless. Whole
numbers put the crests on the viewBox edges, which is a look, not a
constraint. The comments now say that.

The hand-rolled YAML reader is gone: the file is produced by toYaml, so
comparing the whole file to a fresh render is the same check, stricter, and
needs no parser. With it go the unused `period` field, two needless exports,
a duplicated loop condition and a ternary whose arms were identical.

The invariant was written out in seven places and had already drifted, which
is how the integer claim survived. It is now stated once, in the header of
the data file, where someone reading the data will actually find it; the
rest point there. Remaining comments cover the negative-modulo step, why the
accessibility probe asserts on iteration count rather than duration, and why
that probe checks it has something to look at.

Also: the partial looks layers up in one pass instead of a nested range, and
builds the "expected one of" list from the variant table so the two cannot
disagree.

Every assertion was re-checked by breaking what it guards: a hand-edited
path, a drift flipped in the data, a drift flipped in the stylesheet, the
animation deleted, the generator losing its margin, and the generator's
coverage formula replaced. All six fail; the suite is green otherwise.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

✅ Preview deployed at https://31--capro-uio.netlify.app
Please check it looks ok before merging.

@github-actions

Copy link
Copy Markdown

✅ Accessibility: no issues

axe-core over 19 routes × 2 viewports (one page per layout), plus 71 manual checks.

All 71 manual checks passed.

Automated tooling catches roughly a third of accessibility problems. A clean run is a floor, not a ceiling.

@drmowinckels
drmowinckels merged commit 3156741 into main Nov 24, 2026
2 checks passed
@drmowinckels
drmowinckels deleted the wave-drift-animation branch November 24, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant