Documentation comes from this release commit, without inheriting newer content. Commit: 371ee4692c.
Feature — Onboarding
A one-time 6-step intro carousel shown to new users. Completion is persisted in MMKV so returning users skip straight to sign-in.
Designs live in Figma file AuNNzmm0PbYXoZ0g3forCY, frames 27:13040 / 27:13048 / 27:13056 / 27:13061 / 27:13385 / 27:13437.
Files
Route: app/(onboarding)/index.tsx re-exports OnboardingScreen.
Slides
Visual stack
Film
The single onboarding screen opens on a film (OnboardingIntroFilm, played through the app's shared VideoPlayback, an expo-video VideoView; the ad backfill uses the same component). The video paywall (script 3) plays the same film through the same component; it only shows on the popular catalogue, so there it is always ShowOff. The pick is onboardingFilm, and useOnboardingVideoSource resolves it to the bundled file for both surfaces. A new player's launch no longer waits on the splash for Remote Config, so the hook picks no film until this launch's config has hydrated (the screen's artwork shows meanwhile): is_public says which film a build may show, and a public-domain build must never open on ShowOff.
Start waits for the locked variant. Once the screen is seen (the splash has gone), decideOnboardingVariant locks the install's A/B-tested values (onboarding_script, tutorial_song, mon_pkg; experiment-decision.ts): the console's answer if this launch's fetch lands within 3 s (EXPERIMENT_DECISION_WAIT_MS) or an earlier launch fetched it, else the in-app baseline (script 4, the console's three songs, no ads arm). Until then Start shows a loading state and takes no tap, and the film waits (the screen's artwork shows). Start waits for nothing else, and never past one ceiling: ONBOARDING_START_GATE_CAP_MS (3 s, kept equal to EXPERIMENT_DECISION_WAIT_MS) after the screen is seen, started by decideOnboardingVariant (onboarding-start-gate.pure.ts, selectStartReady in the store). Past it Start takes a tap even if the variant is not locked yet; Remote Config keeps its own timeout.
No GPU prewarm on the onboarding screen (DEV 19/11/2026: it held Start and made the film hang). The tutorial song warms the GPU under its own loading card, as every song does: the first-hit rehearsal fires each kind of effect once before the 3-2-1 (piano.md, "Loading gate"). To try a fallback install in a development build, set EXPO_PUBLIC_AB_FORCE_FALLBACK=1 in .env.local: the screen ignores the fetch, waits the full 3 s and locks the baseline. With EXPO_PUBLIC_ONBOARDING_REPLAY=1 beside it every Metro reload is a new try, since the replay also clears the lock. Release builds ignore both. The lock sets the ab_source user property (remote | fallback) and, for remote only, sends ab_config_applied — the activation event of every experiment on these keys, so the Firebase A/B report leaves fallback installs out. The wait is reported as onboarding_perf.config_wait_ms. The tutorial's songs and covers are fetched once the variant is locked (prepareTutorialAfterConfig), so they are this variant's. Start also lets the piano sampler load (AppStartupPolicy): starting its audio engine during the film would duck the film's music.
The films ship in the app only: there is no build switch and no Remote Config key for them. ShowOff was kept after the owner tried it against a RushE film as two TestFlight builds; the RushE film and the onboarding_video key (which could replace a film with a URL) are gone. A console that still serves onboarding_video is ignored like any unknown key.
Encoding. The shipped files are 1080², 30 fps, HEVC tagged hvc1 (the tag AVPlayer plays), 3.0 MB for the two. The films were shot in a dark room, so the encode carries a 1.25× gain on each colour channel (RGB, so blacks stay black and the foot still dissolves into the page without a seam); nothing is filtered at runtime. The masters (1080², 60 fps) are gitignored under src/assets/onboarding/Onboarding_video/; ShowOff's is the cut delivered on 22/10/2026 (HEVC, ~2.8 Mbps), the public-domain one H.264 at ~18 Mbps. Encode from them, never from a shipped file (a second HEVC pass costs quality):
After adding, removing or renaming a film, run bun run assets:sync (the asset manifest is generated and gitignored).
The film fills about two thirds of a phone, ~1,800 px tall on a 3x screen. The earlier 720², ~0.5 Mbps encode was stretched 2.5× and its text and badges smeared; H.264 at the new quality would weigh about twice as much. onboarding-film-assets.test.ts holds each file to hvc1 at 1080². Android support for HEVC varies by device: encode H.264 (-c:v libx264 -tune film -crf 23) if these files ship there.
Title segments
Slides mix solid-white runs with gradient runs on the same line. Modeled as
title: TitleLines = readonly (readonly TitleSegment[])[]:
OnboardingTitle flattens this into a column of <TextOutlineRun> lines —
each line renders all its segments into a single Skia canvas, side-by-side,
with per-segment gradients. Consolidating onto one canvas per line (rather
than one per segment) cuts the per-slide Skia surface count by ~3× without
changing the rendered output. See <TextOutlineRun> in
src/components/TextOutline.tsx.
State
MMKV key: onboarding. Only hasCompleted is persisted —
shouldShowPostOnboardingPaywall is intentionally in-memory only because it
exists solely to bridge the final onboarding tap to the post-onboarding
paywall. A cold relaunch starts fresh.
Flow
During FTUE, the tutorial gameplay song, the friendly arm's whole offer, the reward picker's Claim and the pick-song Get choice are permanently unlocked as "promo" library entitlements (no rewarded ad). See songs.md.
The onboarding_script variants shape the tutorial's run after the welcome (popular catalogue; a public build always plays Twinkle, then the picker).
From the welcome or the drills to the song (goToTutorialSong): script 4's welcome and scripts 1–3's training drills (finished or skipped) go straight to the choose screen on a choosing run, or to the song (tutorialSongRoute). A "Now you're ready to play your first masterpiece!" beat stood there for 1.5 s until the PO removed it (23/10/2026). The hand-off still sends its fn_tutorial_set, and waits for the run's MIDI as the beat's time let it, at most TUTORIAL_SONG_HANDOFF_MAX_WAIT_MS (1.5 s) — no wait once it has arrived, which on script 4 is long before the welcome is left.
The onboarding A/B test runs on onboarding_script and tutorial_song. The Firebase experiment sets both per group: the script (3 = the old training drills, 4 = the training merged into the first song) and the group's own tutorial_song (its three_songs; keep one_song, which builds on script 1 still read). Typical groups: baseline 3 with today's songs; var1–var3 4 with their songs. Script 4 is script 3 in everything else (the choose screen, the video paywall, the first-song paywall at the 4th song_end, onboardingScriptHasVideoPaywall).
- Default: an install the console names no script for walks
4, and plays the app's copy of the console'stutorial_song(No Batidão, APT, Twinkle — excerpts the app ships). Both equal what the console serves since the onboarding test ended (DEV 16/11/2026), so an install that cannot fetch walks the same run as everyone else; change them together with the console. A value the app does not know (5,0) is dropped and the last one stands; the persisted config is the last-known-good, so a failed fetch keeps the console's last script. - Locked for good:
onboarding_script,tutorial_songandmon_pkgare locked once per install (experiment-lock.pure.ts, kept in MMKV and laid over every Remote Config update by the store), so a fetch that lands later — Firebase placing the player in a group after they met the baseline — changes nothing they play. The monetization slice reads the lockedmon_pkgtoo (readEffectiveMonetizationValue; the DevTool's rules still win). Only a consoleab_lock_versionabove the round an install locked in lets it lock again: bump it when a test starts or ends, never while one runs. Where and when the lock is taken is the onboarding screen's decision. - Fixed per run: the run reads the script once (
getTutorialScript), so the welcome's training decision and the songs agree even if a fetch lands in between. - Reported: as the
onboarding_scriptuser property at launch. - Old builds: a build from before script 4 drops the value and walks its own default (script 1). Target the experiment at the new app version.
- Forced by the build:
EXPO_PUBLIC_RC_FORCE_ONBOARDING_SCRIPTmakes any build walk one script whatever the console says. No CI job sets it (ci-cd.md): TestFlight follows the experiment as the store build does, so a group's script and itstutorial_songalways arrive together. To keep a tester on one group, give their build number its own Remote Config condition above the experiment. In a development build,EXPO_PUBLIC_RC_ONBOARDING_SCRIPTin.env.localwins over both (dev-overrides.ts).
Trying the tutorial's songs without the console (development builds only; the store build ignores these, so players are never touched). In .env.local:
EXPO_PUBLIC_RC_TUTORIAL_SONG replaces tutorial_song and is read entry by entry, as the console's value is. APT. and Dance Monkey are rewarded-video songs whose excerpts the app ships (no download), so picking one shows the unlock. With "balance" the picked song is free in the Song list afterwards, the reward picker follows the song, and the song not claimed stays locked; with "friendly" all three are free after Get. Restart Metro after editing .env.local.
Every script reports its "get a song" step as fn_tutorial_get_song (song_id, song_name), so the scripts' funnels line up: script 1 on the picker's Get, scripts 2, 3 and 4 on the choose screen's Get, before the song starts (tutorialChoiceGetSongParams names the song by its catalog id, as the song's own events do).
The choose screen (TutorialChooseSongScreen, rules in choose-song-store.ts):
- How many songs. Always the first 3 entries of
three_songs(fewer only when the console names fewer), so order the list by priority (tutorialOfferSize). Script 1 is unchanged (one song). - How many are free. Fixed by the install's monetization arm — friendly (and no arm) 3, balance / aggressive / very_aggressive 2 (
mon-arms/); before the arm is known the friendly 3 stands. The console cannot change it: atutorial.free_songsinmon_pkgis ignored and noted (mon-pkg-mapper.ts), and the tutorial holds any count to 2–3 besides — the PO changes only which songs (tutorial_song). It becomes the run's reward plan (tutorialRewardPlan), fixed with the run's songs:grant_all(free ≥ songs offered — friendly): Get unlocks every offered song for good in the Song list (promo grant, even when a row is VIP or a rewarded video). The line under the cards: "All 3 songs stay unlocked in your song list." The song ends on the Game Mode result as before.pick_after_play(2 ≤ free < songs offered — the other arms): Get unlocks only the song picked ("The song you pick stays unlocked in your song list."). After its excerpt the Game Mode result shows only the score (SessionResultOverlaysummaryOnly: stars, score and judgements, centred; no suggestion column, previews or buttons), holdsTUTORIAL_SCORE_HOLD_MS(3 s: the stars' 1.5 s pop-in, then the 1.5 s hand-off beat) after the count-up, and the route's fade replaces it with the reward picker (tutorialResultLeadsToReward).single: a run with no choice (script 1, public builds) or only one distinct song — that song.
- Cards. Title, artist, the run's difficulty tag (as a flat chip; the console's
difficulty/diff_tag, PO 09/11/2026) and a Get button. The cards (two or three) always sit in one centred row capped at their Figma width; where the width is short (a small iPad with three cards) they narrow evenly instead of scrolling (TutorialPickSongRow).
No paywall reads Remote Config enableIAP: that flag only switches the single-song deals (the No Ads package no longer follows it either — see remote-config-enable-iap.md). Every script's paywalls — the one after the film, script 3's video paywall and its held-back first-song paywall — show whatever it says (paywalls-ignore-enable-iap.test.ts).
The reward picker (TutorialRewardScreen, /(tutorial)/reward, rules in reward-song-store.ts) ends the song on pick_after_play runs: "Great job! Pick your reward — Choose 1 song to unlock now. The other one stays available to unlock later." It shows the offered songs the player did not play, each with Claim (and the choose screen's previews).
- Claim unlocks that song for good (promo grant), ends the tutorial and opens the song's full chart from the Song list (
pendingPlay{ kind: "play", full: true }→/(app)/play?full=1,songPlayType: "tutorial_next"), so pause → Songs goes back to the Song list as any song does. - The song not claimed keeps its catalog lock: a rewarded-video song opens with one rewarded video, a VIP song needs VIP.
- End jobs (
useTutorialRunEnd, shared with the result):song_result(sent by the score-only result before it),reachedResultfor a relaunch, the tracking prompt as the picker arrives (the score-only result asks nothing), then script 3/4's video paywall over it (closing it leaves the player on the picker). Claim waits for the tracking answer.
The choosing runs' result (TutorialSongResultScreen) is the Game Mode result (SessionResultOverlay, Play tab lit). It shows the excerpt's score, frozen at game over (tutorial-song-result.ts).
- Kept from Congrats:
song_result, the tracking prompt and script 3's video paywall. The last two happen on the run's first result only, after the reveal. - Not run here: interstitials, and the first-song and replay paywalls.
- No Replay: the action row has Song list and Next song only (
SessionResultOverlaywithoutonReplay); each tutorial song is played once. - Leaving: Song list and Next complete the tutorial. A suggestion rides out with the completion (
pendingPlay), andTutorialExitHostopens it once the app exists. A locked one plays its rewarded video first, as on the Game Mode result. A gameplay pick raises the rootPlayLaunchCoverfirst, so the Song List the app lands on (and the Game Mode result'sreplaceinto a next song / replay) never shows before gameplay. The cover wears the loading card's face (PrepareLoadingFace: the prepare art and the piano-keys loader), and it lifts only once BOTH the play route has arrived (useScreenEntered→markPlayLaunchEntered) and its loading card has painted (PrepareLoadingOverlay, two frames after mount →markPlayLaunchCardPainted), so the hand-off from cover to card is invisible. A 4 s backstop restarts whenever the hop moves on (refreshPlayLaunchCoverinTutorialExitHost, right before it pushes play), so the reward claim's app-group wait no longer runs it out. A play visit opened under the cover carriescover=1(playParamsUnderCover/playHrefUnderCover) and opens without the stack's fade (playOpensUnderCoverinapp/(app)/_layout.tsx): on a first play, with the Song List mounting at the same time, the cover could lift on the route's 700 ms arrival backstop while the fade was still running, and the Song List flashed through the half-faded play screen (iPad A16). - Choosing the next song: the result's song cards carry no CTA. A tap selects one (the top card by default), and Next opens it — with the video glyph when it is ad-locked (songs.md).
- No Learn tab: Learn Mode opens after four finished songs, so a first-run player sees no toggle here — only the Play recommendations under "Recommended for You" (songs.md).
- Waits for tracking: every exit waits for the tracking answer.
- Relaunch: reaching the result ends the run for a relaunch. A player who quits the app on the result or under script 3's video paywall comes back to the song list, not the training. The result sets the tutorial store's persisted
reachedResult; the screen on view stays up, and the next cold start restores the tutorial as complete (restoreTutorialPersistedState). Except a reward picker still owed a claim (pick_after_play): the run's end also saves the picker's cards (pendingReward,reward-song-store.tsreachEnd), so a player who quits on the score-only result or on the picker comes back to that same picker (TutorialEntryScreenopens it in place of the Welcome), not the song list. The saved cards win over a relaunch's fresh offer; Claim clears them with the tutorial's completion. Before the result, a relaunch starts the tutorial again (Welcome, and the drills on scripts 1–3), but a choosing run whose song was already picked does not offer the choice again: the pick is saved as it is made (savedPick,choose-song-store.ts), and the hand-off (goToTutorialSong) replays that song (resumePick, found by catalog file in the rebuilt offer, else its old place), so a second pick cannot unlock a second song. Cleared with the tutorial's completion.
On script 1 and public builds, a song's result is the Congrats celebration. The last song's celebration ends the run for a relaunch, as the choosing runs' result does: quitting there, or on the picker after it, comes back to the song list. It stays until the celebration has fully come in, then 1.5 s more (tutorialResultHoldMs). The choose screen has no close: the player picks one of its songs.
Song previews on both pickers. On "Pick Your First Song" and "New song available!" each cover is a preview button: a tap plays fifteen seconds of the song (the badge turns into the moving wave), and the songs also play one after another on their own, half a second after the cards are up, each fading in over half a second (TUTORIAL_PREVIEW_START_DELAY_MS). It is the result screens' queue (useSongPreviewQueue) without their 3 s wait and 2 s fade, which hold the music back for the score; here the songs are the screen. On the choose screen the queue repeats: after its last song it goes back to its first, in the same order, until the player taps Play (repeat: true; the picker and every other screen play their songs once). The card whose song is sounding moves with the music (TutorialPreviewRipple, rules in preview-beat-fx.pure.ts). Every note the preview plays (subscribeBeats) kicks the cover, feeds a soft purple halo that glows brighter the busier the music is, sends a glowing ring out of the cover's edge, each ring the next of cyan, purple and magenta (glow and line alike), (one per note, at most one every 110 ms, so a chord is one ring) that widens to 2.2× and fades as it grows. A fast passage fills the space; a slow one leaves a ring or two. Round it, a cyan → magenta comet arc (a sweep gradient with a blurred glow under a crisp line) orbits just clear of the cover at its own steady pace, one turn per 2.4 s (SPIN_LAP_MS): the one part that does not follow the notes. It is one Skia canvas behind the cover, larger than it, so the row never jumps; its blur, stroke and gradient programs are drawn at 1/255 when the screen arrives, so the first note does not stutter. With Reduce Motion on, nothing listens to the notes and only the halo shows, still. A choose-screen song is previewed by its catalog name (its game chart's busiest 15 s, never a recording), never by its tutorial chart (tutorial-song-preview.pure.ts). Play, Get and close stop the previews before leaving; the picker's tracking prompt counts as a screen cover, so nothing plays under it. No analytics event is sent. Rules: tutorial-song-choice.pure.ts, tutorial-song-result.ts, first-song.pure.ts.
Each tutorial_song entry can also set the difficulty tag its song shows on the choose screen's card and the song's intro (a chip as wide as its word, the intro's title block just under the cover and over the rays, PO 09/11/2026) and on its tutorial result (the end picker's cards show no tag, PO 23/10/2026): "difficulty" takes the sheet's number (1–6) or the song list's label ("easy", "hard", any case) and replaces the catalog row's; "diff_tag": false hides the tag. Both are optional; an unreadable value is ignored, never the song. The tag is drawn bare, like the song list's. Analytics keep the catalog difficulty.
Which catalog song an entry is. The card (title, artist, cover, the preview it plays), the song it unlocks and its analytics come from the catalog row the entry names (catalogSongForEntry), in the live catalog: the bundled songs.json overridden by the newest song_catalog (Remote Config / CDN) this device has fetched — the list the Song list shows (tutorial-catalog-source.ts). A song added to the sheet and published in song_catalog after a build can therefore be a tutorial song, cover and all, without a new build. On a first install the catalog refresh runs after the first paint: a song only in song_catalog is found if the refresh lands before the run's songs are fixed (on the choose screen, or the first song on script 1); otherwise that slot plays the stand-in. Every tutorial screen shows the fields copied when the run was fixed, so the choose screen, the song and its result always name the same song. A slot that plays the stand-in leaves a crash-report breadcrumb with why (empty_slot, no_catalog_row, midi_missing).
"song_id"(optional, read from 1.0.8): the row'sidin the catalog, thesong_idsong events send (dance-monkey,no-batidao,fur-elise,apt,twinkle-twinkle-little-star). It is matched exactly and wins overname. An id no row has plays the stand-in rather than whatevernamewould find, so a typo shows on the device."name"(required): withoutsong_id, the row whose file name, id or title it matches, ignoring case, accents, spaces and punctuation. Keep it besidesong_id: builds beforesong_idmatch bynamealone, and drop an entry without one.
Excerpts the app ships play with no download. An entry's midi is fetched while onboarding runs, unless its file name is one the app carries under src/assets/tutorial/: then the song plays that bundled chart, and nothing is downloaded or waited for (bundledTutorialExcerpt, prepareTutorialRun). The match is the file the URL ends in, exactly (case included), wherever it is hosted: …/Q4_Folder/tutorial_1stUA_package/APT_RoseBrunoMars_tutorial.mid plays the bundled APT_RoseBrunoMars_tutorial. The app ships the excerpts of the Instant songs:
The CDN keeps a copy of each, for builds that predate it and as the source of truth. A file whose notes change takes a new file name: the old name keeps playing the copy the app shipped with. Adding an excerpt to the app is committing its .mid under its CDN file name; charts:convert-tutorial turns it into a chart at build time.
The CTA never skips ahead — each tap advances by one slide; the final tap arms the post-onboarding paywall (see stepper.ts and its tests). Horizontal pan gestures advance / retreat the index with the same single-step semantics; vertical drags fail the gesture so child views (none today) keep working.
Training drills
Scripts 1–3 only. On those scripts the welcome's "Let's go!" opens the drills below (TutorialWelcomeScreen); script 4 goes on to the song (the choose screen first), and its first song teaches the tap and the hold instead (Guided first song). fn_training_set / fn_training_ready still come from the welcome; fn_training_start / fn_training_end are no longer sent.
tutorial_start (step: step_tap | step_hold) reports each lesson once the player has done it: on the drills (scripts 1–3) when the tap drill and the hold drill are passed; on the guided first song (script 4) when its first tap note is played and its first hold's head is played (it need not be held to its tail, PO 23/10/2026).
The drills' Skia sheets bake on the practice mount. Nothing is baked ahead (the TutorialPracticePrewarm / KeyboardAtlasPrewarm / JudgementAtlasPrewarm launch warmups were dropped: they held the splash and loaded the app before the FTUE), so the practice's keyboard sheets and lane master atlas are cut in its own mount, under the loading card. tutorialPracticeBeamFloorPx (tutorial-practice-beam.ts) is the one beam floor TutorialGameplayCanvas holds, so the master-atlas key does not swing between steps. The surface mounts in two commits: TutorialGameplayStack mounts the lane canvas, and the keyboard two frames later (useStagedMount — frames, not an idle slot: the idle queue ran both stages back to back and the stall stayed one piece). The longest single stall is ~440 ms (the canvas, its layers and Skia views) and the keyboard's is ~140 ms; the UI thread's worst frame there is ~55 ms, under the loading card.
The practice screen's two drills (tap, then hold) move on only after a Perfect press
(PERFECT+ or PERFECT). A press is judged exactly as Game Mode judges one: classifyHit on the
live Timing-panel windows, the ones TimingZoneConfigOverlay draws
(judgeTutorialPracticePress).
A GOOD or EARLY press (the great / tooEarly judgements):
- pops its label, GOOD or EARLY, in PERFECT's look (white letters, the yellow outline and
glow;
tutorialJudgementLook), while the note closes in on its centre and fades out (TUTORIAL_RETRY_NOTE_FADE_MS). The key's light goes out with it, even with the finger still on the key: held, it stood in the lane as a golden column and read as the note stuck there; - once the label has played out (
TUTORIAL_RETRY_LABEL_MS, the label's own life), says "Tap Again!" — "Hold Again!" on the hold drill (tutorialRetryMessage) — forTUTORIAL_COACH_COPY_DWELL_MS, raised a tenth of the screen above the drill's other copy; - then drops the note again from the top.
A hold let go too soon. The hold drill also wants the key kept down until the long note's
tail reaches the line. Letting go more than TUTORIAL_HOLD_RELEASE_MARGIN_MS (0.3 s, the last
fifth of the 1.5 s hold — Game Mode allows only its ~25 ms Perfect-late window) before the tail
breaks the hold (tutorial-practice-hold-release.ts):
the ramp stops so the note freezes where the finger left it, EARLY pops (the tap drill's
own word, fire("tooEarly", 0): one label for a press too soon and a lift too soon), the note
closes in on the part still standing above the line and fades, then "Hold Again!" and a fresh
fall — the same retryLabel → retry → drill path a GOOD press takes (beginRetry). Game
Mode's own early release stays neutral; only the training says anything.
The label sits where Game Mode's does, top-centre of the canvas; only the drills draw it in
PERFECT's look, the tutorial song keeps Game Mode's colours. This is the
retryLabel → retry pair of phases in
tutorial-practice-flow.ts. A note resting
on the line takes any press on its key as PERFECT+. The drill's notes fall at Game Mode's lane speed (DEFAULT_LANE_PX_PER_SECOND), so its zones sit as far from the line as a song's. Other keys, and presses while the note is still
above the Too-early window, are ignored.
Tutorial song
The tutorial song is a Game Mode session (useTutorialSongSession over useMagicGameplay) that
waits on each note, drawn by Game Mode's own gameplay group (PlayScreenGameplayGroup, under
GameplayThemeTierProvider): the score (hidden through the 3-2-1, shown at GO), the x2–x5 badge,
the points over each lane, and the glow, smoke, stars and keyboard colours that climb with the
streak. Only the training drills keep the fixed tier-1 look. It draws Game Mode's song progress
rail (PlayScreenSongProgressRail) across the top. The rail stays hidden through the 3-2-1, shows at GO, and fills with the chart's tick up
to totalEndTicks, so it waits with the song
(TutorialSongGameplayPhase).
Before the song starts, TutorialGameplayScreen plays the song reveal: the cover rises with a
pulsing ring over the starry sky, then the title and artist fade in (no difficulty tag on a tutorial song). It is the shared
SongRevealShowcase (with
SongRevealCover, SongRevealMeta, song-reveal.model.ts and
StarryScaffold) in src/components/, because Learn
Mode plays it too — after the "Learn Mode unlocked!" popup's Claim opens Twinkle
(songs.md). The tutorial's result
celebration draws the same SongRevealCover.
A chosen tutorial song starts sooner than other songs
(tutorial-song-start.ts): its reveal
holds 0.7 s once settled instead of 2 s (holdMs, the 0.95 s motion unchanged). The song
mounts under the reveal once it settles — reported by the reveal on the UI thread
(onSettled), so the mount never lands on the entrance — and loads through that hold; its lane
atlas and its keyboard's sheets are baked by the surface's own mount (no
prewarm: the old ones held the splash and loaded the app before the FTUE). Its 3-2-1 is Game Mode's 2 s pre-roll, armed when the reveal hands
over (piano.md). Learn Mode's reveal keeps the 2 s hold.
Guided first song
On script 4, the run's first song, the first time it is played (step.index === 0 && !tutorialRunUsesClassicTraining() in TutorialGameplayScreen), teaches what the training drills did, on two of its own notes (tutorial-song-guide.pure.ts, wired in useTutorialSongSession). Every later song plays as Game Mode.
- The first tap note. The song's first note that is not a hold, as the engine reads a hold (its tempo included: a short long note on a fast song is a tap). Either guided note may come first: No Batidão opens on three holds and taps after them, Fur Elise taps first and holds last. Twinkle has holds only, so only its first hold is guided.
- While it is the note to play, a press on its key (inside the note tolerance) that is not Perfect is ignored. It pops the label it earned, as Game Mode would (GOOD or EARLY — EARLY also for a press before the Early window while the note is on screen; before it shows, the key just sounds), and it sounds, but it scores nothing (no points over the lane) and the note goes on falling.
- The song waits for the note on the line, as Game Mode waits on every note (auto-pause). The moment it does, the training's spotlight (
TutorialPracticeSpotlightOverlay) comes in, dimming everything but the key's column, with "Tap the key when the note reaches the line" (TutorialSongGuideCopy, 50 pt above halfway down to the hit line). It comes in over 588 ms (TUTORIAL_SONG_GUIDE_SPOTLIGHT_ENTER_MS, 1.7× the drills' 1 s pace), and from the same frame the hand of the training drills (TutorialHandGuide) shows the tap gesture on its key. Playing the key clears all three. Every guided wait below brings them in the same way. All three are mounted once byTutorialSongGuideLayerand shown on the UI thread fromguideWaitKindSv(opacity + translate), so a wait starting or ending commits nothing to React. The layer is aforwardRefhost isolated from the gameplay tree (a sibling ofPlayScreenGameplayGroup, outsideGameplayThemeTierProvider): it takes stable props (waits,guideWaitKindSv, one memoizedguideGeometry), builds its Skia layers on an idle JS slot after the surface may mount (useIdleMount, off the lane's first-mount commit), and the session flips its prewarm through the ref handle (guideRef.current?.setPrewarm) — no prop flip.TutorialGameplayScreenre-renders for its own state (the song mounting under the reveal, the hand-over, the reveal's fade), soSongRevealShowcaseandTutorialSongSurfacearememo, and the hand-over reaches the song ascountdownArmedSv(a SharedValue viauseBooleanSharedValue), not a prop: onlysurfaceArmed(the reveal gone) re-renders the song shell. What remains in the Profiler during the reveal and the guide's waits are Reanimated'ssettledStylerenders (FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS, left on by design — see piano.md). Under the Get ready! card their Skia layers draw atTUTORIAL_SONG_GUIDE_PREWARM_OPACITYto warm the GPU pipelines. - A press there scores Perfect however long the wait. Game Mode turns such a press Late after 0.5 s and Miss after 1.2 s (fixed, not BPM-scaled); the guide lifts both limits through
useMagicJudgement'sgetAutoPausePerfectGraceMs(returningundefinedonce nothing is guided, so Game Mode's default grace applies). - A Perfect press while the note is still falling plays on.
- The first hold.
- Its press is guarded as the first tap note's is (PO, 24/10/2026): a press on its key before the line that is not Perfect pops the label it earned and sounds, but scores nothing, and the hold goes on falling to the line. A key held down through such a press does not start the hold on arrival; the player presses again.
- Waiting on the line for its press, it gets the spotlight with the training's hold line, "Hold the key when the long note reaches the line", and the hand (the long press), and its press scores Perfect however long the wait.
- From the press on it plays as Game Mode (PO, 23/10/2026: a hold scores like a tap, and its haptic already tells it from one). Let go early, it keeps its head's points without the completion bonus and the song goes on; held to its tail, it gets the bonus.
Skipping the FTUE (Remote Config onboarding_skip)
Remote Config key onboarding_skip (boolean, default true) controls the FTUE
skip affordances. Read it through
selectOnboardingSkipEnabled —
Firebase-only, with no __DEV__ override, so a dev build shows the same funnel
players get.
With the key set to false, none of the skip affordances render and the flow is
exactly the full funnel. The practice pill is additionally gated on
handler.isPlaying — the pre-roll done, the loading card faded out and the drill on
screen — so it never lands on top of the prepare loading card (the sampler can be ready
while the card is still held its minimum time or fading). Its 0.5 pt rim is the song list
Play pill's rim as it reads on that pill — light blue at half strength
(tutorialSkipBorder) — so it stays as quiet on the pill's near-black fill.
TutorialTrainingOverlay renders the pill only when a caller passes both
showSkip and onSkip, which is why the tutorial song screen (which passes
neither) has no skip.
The screen never navigates. The final CTA calls useOnboardingStore.finishWithPaywall(), which arms shouldShowPostOnboardingPaywall. Root-mounted PaywallHost opens the subscription modal in portrait; dismissing it calls complete(), which flips hasCompleted to true and the root app/_layout.tsx mounts (tutorial). See routing.md.
Post-onboarding paywall handoff
finishWithPaywall() flips shouldShowPostOnboardingPaywall on. <PaywallHost>
watches that flag, opens the global PaywallModal
with POST_ONBOARDING_PAYWALL_VARIANT in portrait, and immediately calls
dismissPostOnboardingPaywall() so a future re-mount can't re-arm the modal.
When the user dismisses or purchases, the host calls complete() (if onboarding
is not yet marked done), which swaps the root layout from (onboarding) to
(tutorial).
The real subscription / IAP plumbing isn't wired yet — the modal's CTAs both advance the flow (same as the in-app paywall flow), which is the seam where billing slots in later.
Why fade-only (no horizontal pager)?
Slides 1–4 share a hero region but the title block changes; slides 5–6 swap the entire layout. A FlatList pager would slide both slides side-by-side mid-swipe, exposing the layout change for a frame. Cross-fading instead — keyed Animated.View blocks with FadeIn / FadeOut layout animations — keeps each slide self-contained and removes the awkward "two layouts visible at once" interstitial.
Debugging
Profile screen exposes a "Reset onboarding flow" button that closes the paywall, resets onboarding and tutorial state, then signs out — re-running the full onboarding → paywall → tutorial sequence.