Repository navigation
Smooth the home animation, and let the landscape travel with the works - #16
Merged
Merged
Conversation
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
src/lib/scrollScene.ts).timeline.progress()directly.react-scrollmagicandscrollmagicare removed.drop-shadowwith a 5rem blur. It is now a radial gradient insideSun.svg. Its stops come from a blur fitted to screenshots of the old filter, so it looks the same.getComputedStyleto learn whether they are on stage; the driver reports it.Scrolling through the opening at 1440x900, two runs each:
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:
For the name, the nearest mountain layer returns from the right.
The strip,
src/assets/svg/Journey.svg, is drawn byscripts/journey.pyin the coordinates and style ofMountain1.svg:Mountain1.svg. The pines areMountain1's own, cut out of its path.Mountain1, the two overlap by 16 units alongMountain1's edge.How it was checked
npm run buildpasses.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