Skip to content

Use a transparent animated palm on the homepage - #1514

Merged
manudeli merged 18 commits into
mainfrom
fix/homepage-palm-webp
Nov 22, 2026
Merged

manudeli merged 18 commits into
mainfrom
fix/homepage-palm-webp

Conversation

@manudeli

@manudeli manudeli commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

On main, the homepage scales a 944 × 416 MP4 to fill the hero. The fronds look soft at larger display sizes, and most of the video frame is sky.

Trade-offs

A CSS gradient fills the sky behind the palm. The animated WebP stores the palm and a narrow area of sky on a transparent 585 × 783 canvas. The MP4 on main is 1.57 MB. The animated WebP is 1.85 MB and its still is 22.5 KB. Together the two WebPs are 1.88 MB. On main, Chrome also fetches a responsive poster and its JPEG fallback.

In both tested viewports, the PR renders the palm image element at 450 CSS px wide before clipping. All 121 source frames play in their original forward order at 24 fps. The 41–42 ms frame delays make a 5.04-second loop. Lossy compression softens some fine leaf edges at high magnification.

The page displays the still WebP first. With motion enabled, Chrome requests the animation in parallel and paints it over the still as frames arrive. The still is pixel-identical to the first decoded animation frame. The in-page play/pause button has been removed. With the system’s reduced-motion preference enabled before loading, Chrome requests only the still for the palm. Changing the preference updates the artwork on the open page. If the animation request fails, the still remains visible.

Loading priorities

What loads and when
Above the fold (ATF) The HTML includes the headline, links and palm. The first frame has a high-priority preload. When motion is enabled, a second high-priority preload starts the animation request and the <picture> element selects the animated WebP. The route loader awaits recent blog posts. The npm and GitHub stats queries have been removed from that loader.
Below the fold (BTF) and viewport-dependent sections The stats and prompt builder hydrate on visibility with a 0px root margin, so stats can hydrate on the first screen. On main, the prompt builder uses a 180px 0px root margin and explicitly prefetches at idle. This PR removes that idle prefetch. The content inside each feature panel uses a 200px root margin. The existing partners/blog and community sections keep their 25% margins. The server HTML includes the recent blog post links.

The headline starts at the same position on main and PR, at (24, 98) for 390 × 844 and (76, 511) for 1512 × 806 (CSS pixels).

Main vs. PR

The November 22, 2026 measurements compare two pinned Cloudflare deployments. AS-IS is the MP4 homepage from main at 7800cbda. TO-BE is the WebP homepage from this PR at 08cf2ca8. AS-IS deployment · TO-BE deployment

Cache-disabled reload recordings

Main is on the left and the PR is on the right. Each 15-second MP4 pairs the first measured run of each version for that device. The clocks align at the reload command.

Mobile · 390 × 844

Mobile cache-disabled reload comparison

Download mobile MP4

Desktop · 1512 × 806

Desktop cache-disabled reload comparison

Download desktop MP4

Measurements

Both versions ran on the same host in headless Chrome 158.0.8127.36. Mobile used touch emulation (390 × 844, DPR 3) and desktop used 1512 × 806 (DPR 2). Each trial opened the live URL once in a fresh browser context with the HTTP cache disabled and service workers blocked. We then applied 5 Mbps in each direction and 40 ms of added latency and reloaded at the top of the page. Motion was enabled, autoplay was allowed and we applied no CPU throttling.

Each column is the median of four cache-disabled reloads, for 16 reloads in total. The order of main and PR alternated by round for each device. Timings start at navigation and include the live HTML response. These are repeat-load lab measurements with an already-opened origin. These timings cover the whole homepage, including the route loader and media changes. The measured main build also includes newer mobile navbar and stats layout changes.

Metric Mobile AS-IS Mobile TO-BE Desktop AS-IS Desktop TO-BE
First HTML byte 0.28 s 0.20 s 0.36 s 0.20 s
First contentful paint (FCP) 1.12 s 1.12 s 1.28 s 1.09 s
First visible palm 1.16 s 1.13 s 1.49 s 1.10 s
First visible leaf movement 2.71 s 1.19 s 2.59 s 1.17 s
Largest contentful paint (LCP) 1.12 s 1.12 s 1.48 s 1.09 s
Observed frame advances in the first 5 s of motion 117 110 111 107.5
Last palm media response completed 5.09 s 4.86 s 5.31 s 4.85 s
Palm media transferred 1.91 MB 1.88 MB 1.97 MB 1.88 MB
Palm media requests 3 2 3 2

We recorded Chrome’s FCP and latest LCP entry during each observation window (about 15 seconds after reload). For the visual timings, we compared the palm crown in screen captures from FCP onward with main’s posters and the 121 source video frames. First movement is the first forward frame change confirmed by the next one. This excludes the poster swap on main. These timings are estimates limited by screen capture cadence. The five-second count measures identifiable frame changes in the capture. Transfer totals include completed palm media responses and their response overhead.

In all four runs per device, Chrome reported the responsive poster as LCP on main (1600w on mobile and 2400w on desktop) and the 22.5 KB still as LCP on the PR. The first visible movement occurred before the animation finished downloading in 8 of 8 PR reloads. The median gap between the first visible palm and first visible movement was 67 ms on mobile and 67 ms on desktop. Total palm transfer fell by 1.6% on mobile and 4.6% on desktop.

First visible leaf movement and LCP in each round

Values are seconds from reload, written as first movement / LCP.

Round Mobile AS-IS Mobile TO-BE Desktop AS-IS Desktop TO-BE
1 2.48 / 1.10 1.15 / 1.07 2.30 / 1.64 1.17 / 1.10
2 2.90 / 1.18 1.24 / 1.16 2.61 / 1.32 1.16 / 1.08
3 3.05 / 1.14 1.44 / 1.36 4.28 / 2.25 1.17 / 1.09
4 2.51 / 1.09 1.13 / 1.05 2.58 / 1.28 1.11 / 1.03

pnpm test and pnpm build passed. Checks for this revision · Latest branch preview

@changeset-bot

changeset-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 08cf2ca

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 08cf2ca Commit Preview URL

Branch Preview URL
Nov 22 2026, 04:34 AM

@manudeli
manudeli marked this pull request as ready for review November 22, 2026 04:43
@manudeli
manudeli merged commit af6ec4f into main Nov 22, 2026
7 of 8 checks passed
@manudeli
manudeli deleted the fix/homepage-palm-webp branch November 22, 2026 04:46
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