Card journey
Scroll progress becomes three variables normalized from 0 to 1: leaving the hero (q), moving through the benefits (p) and landing in the app (m). Each phase has its own easing, and the result goes into CSS custom properties that drive position, scale, rotation and glow.
To measure accurately, positions add up offsetTop/offsetLeft: AOS applies transform to elements and skews getBoundingClientRect.
- 01Scrollpassive listener
- 02One frameguarded rAF
- 030-to-1 phaseswith easing
- 04CSS variablesposition, scale, glow
- 05CSS transformon the sticky card
// q: saída do hero (0 = cartão no hero, 1 = cartão no centro da jornada)var q = clamp(-fr.top / (J.heroH * (mobile ? 0.45 : 0.7)), 0, 1);var qe = ease(q);// p: progresso pelas linhas de benefíciosvar p = clamp((mid - (fr.top + J.rowsTop)) / Math.max(J.slotCY - J.rowsTop, 1), 0, 1);// m: pouso no appvar dist = fr.top + J.slotCY - mid;var m = clamp(1 - dist / Math.min(vh * 0.7, 560), 0, 1);var me = ease(m);var s = J.heroScale + (1 - J.heroScale) * qe;s += (J.finalScale - s) * me;var tx = (J.txHero + (J.tx0 - J.txHero) * qe) * (1 - me);var b = J.body.style;b.setProperty('--tx', tx.toFixed(1) + 'px');b.setProperty('--s', s.toFixed(4));b.setProperty('--glow', (1 - me).toFixed(3));







