Skip to content

Smooth the home animation, and let the landscape travel with the works - #16

Merged
RedCarpG merged 9 commits into
masterfrom
ccr-81ab975e-am6ioj
Nov 29, 2026
Merged

RedCarpG merged 9 commits into
masterfrom
ccr-81ab975e-am6ioj

Conversation

@RedCarpG

@RedCarpG RedCarpG commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Three changes to the home page's scroll animation.

1. Smoother, cheaper frames

The opening animation stuttered. Measured in a headless browser while scrolling through it, there were three causes.

  • Steps with a mouse wheel. The animation followed the scroll position exactly, and a wheel scrolls about 100px per notch, so the scene jumped. It now eases toward the scroll position over about 120ms (src/lib/scrollScene.ts).
  • A React re-render per scroll event. react-scrollmagic re-rendered the whole timeline on every scroll event. The new driver calls timeline.progress() directly. react-scrollmagic and scrollmagic are removed.
  • A blur recomputed every frame. The sun's glow was a CSS drop-shadow with a 5rem blur. It is now a radial gradient inside Sun.svg. Its stops come from a blur fitted to screenshots of the old filter, so it looks the same.
  • The works' previews no longer poll getComputedStyle to learn whether they are on stage; the driver reports it.

Scrolling through the opening at 1440x900, two runs each:

Before After
Mouse wheel, 30 notches: frames in which the sun moves 10 49–55
Mouse wheel: largest jump of the sun in one frame 442px 144px
Trackpad-like scroll: frames over 33ms 126–132 76–79
Trackpad-like scroll: script time 372–398ms 172–175ms
Compositing time over the same scroll 7.3–7.6s 3.2s

The headless browser composites in software, so absolute times are much higher than on a machine with a GPU. The comparison between the two builds is what counts.

2. The sun keeps moving while the mountains rise

At "Scroll on to see my work" the sun held still while all four mountain layers rose in front of it. Against that much rising landscape a still sun reads as dropping, most of all on large screens, and then it set off to the upper right. Frame by frame it never moved down; it only stopped.

The sun and its two clouds now travel in one move across stages 3 and 4. Their end positions are unchanged.

3. The landscape travels with the works

While the works were on show, the landscape used to draw back: the sun moved to the centre and the mountains sank. Now the sky, the sun and the far mountains stay, and only the foreground moves. The nearest mountain layer slides out to the left and a strip slides in behind it, one screen per work:

  1. A pavilion on a crag, for the agent skills.
  2. Open water with the sun in it, for ChroniQ.
  3. A moon bridge, for Lost Viking.
  4. A boatman, for the design work.

For the name, the nearest mountain layer returns from the right.

The strip, src/assets/svg/Journey.svg, is drawn by scripts/journey.py in the coordinates and style of Mountain1.svg:

  • One continuous landscape. The far shore and the water run its whole length behind the near ground and show only where the ground dips out of the frame, so nothing starts with a straight edge.
  • The same drawing style. Filled shapes only, the same ground gradient, and water as white with a blurred grey reflection, as in Mountain1.svg. The pines are Mountain1's own, cut out of its path.
  • One curve for the bridge. The bridge's deck, arch and railing all come from the same curve.
  • No hairline at the joins. Where the strip meets Mountain1, the two overlap by 16 units along Mountain1's edge.

How it was checked

  • npm run build passes.
  • For the frame changes, old and new were screenshotted at six points of the opening. The scene is unchanged, and the glow's falloff matches within one or two colour levels.
  • The sun's position was logged at each step on 2560x1440, 1920x1080, 1440x900 and 1280x720. It now moves up continuously through stages 3 and 4. The one exception is 1280x720, where it sinks about 15px while moving right, because there the original end point is slightly lower than the start.
  • The whole showcase was captured every 0.8 units (135 frames) and scanned for one-pixel seams. None remain.
  • Scrolling through the whole showcase: p95 frame time 33ms with a mouse wheel, the same as before the strip was added.
  • On desktop and phone sizes, each work's preview starts on its stage and stops after it. No console errors.

On a portrait phone the nearest layers, the old one and the strip alike, sit below the bottom of the screen at this point of the animation, so the strip is not seen there.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW

Three causes of the stutter, each measured in a headless browser while
scrolling through the opening:

- The animation followed the scroll exactly, so a mouse wheel, which
  scrolls about 100px per notch, moved it in jumps: the sun moved in 10
  frames over 30 notches, up to 442px at a time. It now eases toward
  the scroll position over about 120ms (src/lib/scrollScene.ts): 52
  moving frames, at most 144px.
- react-scrollmagic re-rendered the whole timeline in React on every
  scroll event. The new driver calls timeline.progress() directly, and
  react-scrollmagic and scrollmagic are removed. Script time while
  scrolling dropped by more than half.
- The sun's glow was a CSS drop-shadow with a 5rem blur, re-blurred on
  every frame; it was three quarters of the compositing time. The glow
  is now a radial gradient inside Sun.svg, its stops computed from a
  blur fitted to screenshots of the old filter, so it looks the same.
  Compositing time dropped by 57%.

The works' previews no longer poll getComputedStyle four times a
second to learn whether they are on stage; the driver reports it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
While the works were on show, the landscape drew back: the sun moved
to the centre and shrank, and the mountains sank, undoing the scene
that had just opened. Now the sky, the sun and the far mountains stay
where stage 4 leaves them, and only the foreground moves: Mountain1
slides out to the left and a new strip slides in behind it, one
screen per work. A pavilion on a crag for the agent skills, a river
holding the sun's reflection for ChroniQ, a moon bridge and a willow
for Lost Viking, a boatman for the design work. For the name,
Mountain1 returns from the right.

The strip, Journey.svg, is drawn by scripts/journey.py in the same
coordinates and ground gradient as Mountain1.svg, so the two meet
without a seam.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
@RedCarpG RedCarpG changed the title Smooth the home animation and make its frames cheaper Smooth the home animation, and let the landscape travel with the works Nov 29, 2026
At "Scroll on to see my work" the sun held still while all four
mountain layers rose in front of it. Against that much rising
landscape a still sun reads as dropping (induced motion), most of all
on large screens, and then it set off to the upper right. Frame by
frame the sun never moved down; it only stopped.

The sun and its two clouds now travel in one move across stages 3
and 4, from where stage 1 leaves them to where stage 4 used to end, so
they rise with the mountains. The end positions are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
…tyle

Three problems with the first version:

- Seams. Each screen was drawn on its own, so the far shore and the
  river began with straight vertical edges that showed during the
  slide. The strip is now one continuous landscape: the far shore and
  the water run its whole length behind the near ground and show only
  where the ground dips out of the frame.
- The moon bridge's railing was a separate curve that did not follow
  the deck. The deck, the arch and the railing now all come from one
  curve.
- Style. Reeds, willow strands and ripples were drawn as lines, and
  the pines were imitations. Mountain1 uses filled shapes only, and
  water as white with a blurred grey reflection; the strip now does
  the same, and its pines are Mountain1's own, cut out of its path.

Where the strip meets Mountain1 the two layers now overlap by 16 units
along Mountain1's edge; edge to edge, anti-aliasing left a hairline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
The gap. The foreground layers are sized in % of the viewport, which
excludes the scrollbar, but slid in vw, which includes it, so each
screen of travel came up one scrollbar short. Over the four-screen
strip that left a gap of about 33px where it meets Mountain1 for the
name. Both now slide by percentages of their own widths. Checked with
a real scrollbar showing: the layers meet at 0px at both joins.

The sun. Scaled about its bottom edge, it shrank downward while its
clouds rose over it, so between "Developer and designer" and "Scroll
on to see my work" it still seemed to sink. For its long move it now
scales about its centre, switching origin at scale 1 so nothing jumps;
its centre only rises, on every screen size checked.

The willow and the reeds are back, drawn as filled, tapering blades
like the rest of the strip instead of as strokes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
The strip's water lay at y = 296, far above Mountain1's lake at 482,
so the two did not meet at the joins, and a bank that dropped straight
to the bottom of the frame stood like a block in the water.

The strip now uses Mountain1's lake, built the same way: ground filled
down to 500, a white lake from 482, and the land reflected with
Mountain1's own mapping, gradient and filter. The banks slope down to
the water as Mountain1's valley does. The lake runs on past both ends
before it is cut, so the filter's edge glow stays out of sight.

Mountain1's lake sits below the bottom of the screen, so while the
works are on show both foreground layers rise from 30vh to 16vh to
bring it into view; the works move up to leave the lower 40% to it.
Measured with a scrollbar showing at 1920x1080, the lake line meets
across both joins within 0.03px.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
The seam on entry. The foreground's entry started at show1 - 6, but
stage 4's tween on Mountain1 runs until show1. For those six units two
tweens set Mountain1's y, and it fell out of step with the strip. A
jump straight to a scroll position renders the right value, which is
why screenshots taken that way looked fine; scrolling continuously did
not. The entry now starts at show1. Scrolling with a mouse wheel back
and forth through both joins at three screen sizes, the two layers
stay level in every frame in which both are on screen.

The landscape was sparse. It now has more of Mountain1's pines, a
thatched hut with a fence, stone lanterns by the bridge, rocks, an
islet with a pine in the open water, and on the far side two pagodas
and two sailboats, all as filled shapes and reflected in the lake.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
The sliver at the right edge. Parked just off screen before the works,
the strip's overlap with Mountain1 (16 units drawn past its left edge
so the two meet without a hairline) reached about 12px onto the
screen, at a different height while Mountain1 was still settling. The
strip is now hidden until the works start and after they end.

The near bank. The strip is the middle distance, the shore across the
water. A new layer, NearBank.svg (drawn by scripts/nearbank.py), is
our side of the lake, along the bottom of the screen: a low bank,
reeds, grass, rocks and pines leaning in from below the frame, darker
than the rest and slightly out of focus. It pans with the strip and
is empty for 300 units at each end, so it enters and leaves without
an edge.

Checked by scrolling with a mouse wheel back and forth through the
whole showcase: the strip never shows outside it and never falls out
of step with Mountain1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
The text was Cairo 300 in mid grey, set straight over mountains and
clouds. It now sits on a patch of mist, a radial gradient of white
that fades out with no edge (no blur, so nothing to recompute while
the scene moves), and the title and description are Cairo 400 in a
darker ink.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MvmRSn3exZ9iNNkys8u5dW
@RedCarpG
RedCarpG merged commit b5b6b6a into master Nov 29, 2026
2 checks passed
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.

2 participants