-
-
Notifications
You must be signed in to change notification settings - Fork 28
Animate OTA launch flow on homepage How It Works #993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
riderx
wants to merge
16
commits into
main
Choose a base branch
from
cursor/ota-launch-animation-d973
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6505bf3
feat(web): animate OTA launch flow on homepage How It Works
cursoragent 4815393
fix: restore progress bar on OTA animation replay
cursoragent e98d64c
fix(a11y): move role=img off replay button ancestor
cursoragent e2b1d90
docs: add JSDoc to OTA launch animation helpers
cursoragent 6dc8a0e
fix(web): restore card-3 artwork and teach OTA launch in motion
cursoragent 87aed53
fix(web): make card-3 motion show background download then next launch
cursoragent 8ea7ebe
fix(web): localize OTA launch animation status text
cursoragent b920d35
fix(web): address OTA illustration a11y and translation review threads
cursoragent 555ab56
fix(web): move OTA aria-live region outside role=img wrapper
cursoragent f242254
feat(web): bold OTA teaching motion with progress bar and relaunch beat
cursoragent 30cc955
fix(web): animate OTA app UI as single SVG group
cursoragent b7cd515
fix(web): wire BEAT_C_RELAUNCH into relaunch tween timings
cursoragent 012c34f
fix(web): drive beat C from BEAT_C_RELAUNCH and keep download UI hidden
cursoragent 3c32df7
fix(web): fit beat C return tween within BEAT_C_RELAUNCH
cursoragent f8aa5ab
chore: re-trigger CodeRabbit review on HEAD
cursoragent 844b1d1
chore(web): tiny OTA client comment to re-trigger CodeRabbit on HEAD
TorichanCapgo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
14,020 changes: 9,320 additions & 4,700 deletions
14,020
apps/shared/copy/translationContextByText.ts
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
187 changes: 187 additions & 0 deletions
187
apps/web/src/components/landing/OtaLaunchIllustration.astro
Large diffs are not rendered by default.
Oops, something went wrong.
220 changes: 220 additions & 0 deletions
220
apps/web/src/components/landing/ota-launch-animation.client.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,220 @@ | ||
| import gsap from 'gsap' | ||
|
|
||
| const REDUCED_MOTION = window.matchMedia('(prefers-reduced-motion: reduce)').matches | ||
|
|
||
| const BEAT_A_HOLD = 0.7 | ||
| const BEAT_B_DOWNLOAD = 2.0 | ||
| const BEAT_C_RELAUNCH = 1.4 | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| const PROGRESS_BAR_WIDTH = 141 | ||
|
|
||
| // Beat C offsets/durations are fractions of BEAT_C_RELAUNCH so the storyboard stays in sync. | ||
| const BEAT_C_EXIT = BEAT_C_RELAUNCH * 0.343 | ||
| const BEAT_C_DOWNLOAD_HIDE = BEAT_C_RELAUNCH * 0.143 | ||
| const BEAT_C_BLANK_IN_AT = BEAT_C_RELAUNCH * 0.229 | ||
| const BEAT_C_BLANK_IN = BEAT_C_RELAUNCH * 0.2 | ||
| const BEAT_C_BUNDLE_ABSORB_AT = BEAT_C_RELAUNCH * 0.271 | ||
| const BEAT_C_BUNDLE_ABSORB = BEAT_C_RELAUNCH * 0.3 | ||
| const BEAT_C_BLANK_OUT_AT = BEAT_C_RELAUNCH * 0.586 | ||
| const BEAT_C_BLANK_OUT = BEAT_C_RELAUNCH * 0.229 | ||
| const BEAT_C_RETURN_AT_FRACTION = 0.643 | ||
| const BEAT_C_RETURN_AT = BEAT_C_RELAUNCH * BEAT_C_RETURN_AT_FRACTION | ||
| // Return duration fills the remainder of beat C so the relaunch lands exactly at BEAT_C_RELAUNCH. | ||
| const BEAT_C_RETURN = BEAT_C_RELAUNCH * (1 - BEAT_C_RETURN_AT_FRACTION) | ||
| const BEAT_C_RINGS_AT = BEAT_C_RELAUNCH * 0.679 | ||
| const BEAT_C_RINGS = BEAT_C_RELAUNCH * 0.25 | ||
|
|
||
| function queryParts(root: HTMLElement) { | ||
| return { | ||
| chrome: root.querySelectorAll('[data-ota-chrome]'), | ||
| appUi: root.querySelector('[data-ota-app-ui]'), | ||
| staged: root.querySelector('[data-ota-staged-bundle]'), | ||
| status: root.querySelector('[data-ota-status]'), | ||
| progress: root.querySelector('[data-ota-progress]'), | ||
| progressFill: root.querySelector('[data-ota-progress-fill]'), | ||
| launchBlank: root.querySelector('[data-ota-launch-blank]'), | ||
| liveStatus: root.querySelector('[data-ota-live-status]'), | ||
| stack: root.querySelector('[data-ota-bundle-stack]'), | ||
| rings: root.querySelector('[data-ota-rings]'), | ||
| } | ||
| } | ||
|
|
||
| function hideDownloadUi(status: Element | null, progress: Element | null, progressFill: Element | null, liveStatus: Element | null) { | ||
| gsap.set([status, progress], { opacity: 0 }) | ||
| gsap.set(progressFill, { attr: { width: 0 } }) | ||
| if (liveStatus) liveStatus.textContent = '' | ||
| } | ||
|
|
||
| /** Show the completed OTA update state without animation (reduced-motion path). */ | ||
| function setFinalState(root: HTMLElement) { | ||
| const { chrome, staged, status, progress, progressFill, launchBlank, stack, rings, appUi, liveStatus } = queryParts(root) | ||
|
|
||
| staged?.setAttribute('opacity', '0') | ||
| launchBlank?.setAttribute('opacity', '0') | ||
| stack?.setAttribute('opacity', '1') | ||
| rings?.setAttribute('opacity', '1') | ||
| chrome.forEach((el) => el.setAttribute('opacity', '1')) | ||
|
|
||
| hideDownloadUi(status, progress, progressFill, liveStatus) | ||
|
|
||
| for (const el of [staged, progress, launchBlank, stack, rings, status, appUi, ...chrome]) { | ||
| if (el instanceof SVGElement) { | ||
| el.style.transform = '' | ||
| gsap.set(el, { clearProps: 'opacity,transform' }) | ||
| } | ||
| } | ||
|
|
||
| hideDownloadUi(status, progress, progressFill, liveStatus) | ||
| } | ||
|
|
||
| /** | ||
| * Storyboard (~4.1s): | ||
| * A — App open and usable. | ||
| * B — Download progress fills while the running UI stays up; bundle stages behind. | ||
| * C — App exits, brief launch blank, app returns with update applied. | ||
| */ | ||
| function buildTimeline(root: HTMLElement) { | ||
| const { chrome, appUi, staged, status, progress, progressFill, launchBlank, liveStatus, stack, rings } = queryParts(root) | ||
| const statusText = root.dataset.otaStatusText ?? '' | ||
|
|
||
| if (!appUi || !staged || !status || !progress || !progressFill || !launchBlank || !stack || !rings || chrome.length === 0) { | ||
| return null | ||
| } | ||
|
|
||
| gsap.set(chrome, { opacity: 1 }) | ||
| gsap.set(appUi, { opacity: 1, y: 0 }) | ||
| gsap.set(stack, { opacity: 1, y: 0 }) | ||
| gsap.set(rings, { opacity: 0.72 }) | ||
| hideDownloadUi(status, progress, progressFill, liveStatus) | ||
| gsap.set(launchBlank, { opacity: 0 }) | ||
| gsap.set(staged, { opacity: 0, y: 28 }) | ||
| if (liveStatus) liveStatus.textContent = '' | ||
|
|
||
| const timeline = gsap.timeline({ paused: true, defaults: { ease: 'power2.inOut' } }) | ||
| const beatBStart = BEAT_A_HOLD | ||
| const beatCStart = beatBStart + BEAT_B_DOWNLOAD | ||
|
|
||
| timeline | ||
| .addLabel('beatA', 0) | ||
| .to({}, { duration: BEAT_A_HOLD }) | ||
| .addLabel('beatB', beatBStart) | ||
| .to(progress, { opacity: 1, duration: 0.25 }, 'beatB') | ||
| .to( | ||
| status, | ||
| { | ||
| opacity: 1, | ||
| duration: 0.35, | ||
| onStart: () => { | ||
| if (liveStatus && statusText) liveStatus.textContent = statusText | ||
| }, | ||
| }, | ||
| 'beatB+=0.15', | ||
| ) | ||
| .to( | ||
| staged, | ||
| { | ||
| y: 0, | ||
| opacity: 0.58, | ||
| duration: 0.85, | ||
| ease: 'power2.out', | ||
| }, | ||
| 'beatB+=0.2', | ||
| ) | ||
| .to( | ||
| progressFill, | ||
| { | ||
| attr: { width: PROGRESS_BAR_WIDTH }, | ||
| duration: 1.55, | ||
| ease: 'none', | ||
| }, | ||
| 'beatB+=0.25', | ||
| ) | ||
| .to(rings, { opacity: 1, duration: 0.6 }, 'beatB+=0.35') | ||
| .to({}, { duration: 0.25 }, 'beatB+=1.75') | ||
| .addLabel('beatC', beatCStart) | ||
| .to( | ||
| appUi, | ||
| { | ||
| y: 64, | ||
| opacity: 0, | ||
| duration: BEAT_C_EXIT, | ||
| ease: 'power2.in', | ||
| }, | ||
| 'beatC', | ||
| ) | ||
| .to( | ||
| [status, progress], | ||
| { | ||
| opacity: 0, | ||
| duration: BEAT_C_DOWNLOAD_HIDE, | ||
| onComplete: () => hideDownloadUi(status, progress, progressFill, liveStatus), | ||
| }, | ||
| 'beatC', | ||
| ) | ||
| .to(launchBlank, { opacity: 1, duration: BEAT_C_BLANK_IN }, `beatC+=${BEAT_C_BLANK_IN_AT}`) | ||
| .to( | ||
| staged, | ||
| { | ||
| y: -34, | ||
| opacity: 0, | ||
| duration: BEAT_C_BUNDLE_ABSORB, | ||
| ease: 'power2.in', | ||
| }, | ||
| `beatC+=${BEAT_C_BUNDLE_ABSORB_AT}`, | ||
| ) | ||
| .to(launchBlank, { opacity: 0, duration: BEAT_C_BLANK_OUT }, `beatC+=${BEAT_C_BLANK_OUT_AT}`) | ||
| .fromTo( | ||
| appUi, | ||
| { y: -40, opacity: 0 }, | ||
| { | ||
| y: 0, | ||
| opacity: 1, | ||
| duration: BEAT_C_RETURN, | ||
| ease: 'power2.out', | ||
| onComplete: () => hideDownloadUi(status, progress, progressFill, liveStatus), | ||
| }, | ||
| `beatC+=${BEAT_C_RETURN_AT}`, | ||
| ) | ||
| .to(rings, { opacity: 0.72, duration: BEAT_C_RINGS }, `beatC+=${BEAT_C_RINGS_AT}`) | ||
|
|
||
| return timeline | ||
| } | ||
|
|
||
| /** Initialize viewport-triggered OTA launch animation (plays once). */ | ||
| export function setupOtaLaunchAnimations() { | ||
| document.querySelectorAll<HTMLElement>('[data-ota-launch]').forEach((root) => { | ||
| if (root.dataset.otaReady === 'true') return | ||
| root.dataset.otaReady = 'true' | ||
|
|
||
| if (REDUCED_MOTION) { | ||
| setFinalState(root) | ||
| return | ||
| } | ||
|
|
||
| const timeline = buildTimeline(root) | ||
| if (!timeline) return | ||
|
|
||
| let hasPlayed = false | ||
|
|
||
| const observer = new IntersectionObserver( | ||
| (entries) => { | ||
| entries.forEach((entry) => { | ||
| if (entry.isIntersecting && !hasPlayed) { | ||
| hasPlayed = true | ||
| timeline.play() | ||
| observer.disconnect() | ||
| } | ||
| }) | ||
| }, | ||
| { threshold: 0.45 }, | ||
| ) | ||
|
|
||
| observer.observe(root) | ||
| }) | ||
| } | ||
|
|
||
| if (document.readyState === 'loading') { | ||
| document.addEventListener('DOMContentLoaded', setupOtaLaunchAnimations) | ||
| } else { | ||
| setupOtaLaunchAnimations() | ||
| } | ||
| // chore: bump for CodeRabbit HEAD approval | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.