Page Load Choreography
First-visit page load animation sequence: prevent FOUC with initial hidden state, stagger-reveal content blocks after paint, and skip the animation on return visits using sessionStorage.
$ prime install @community/pattern-page-load-choreography Projection
Always in _index.xml · the agent never has to ask for this.
PageLoadChoreography [pattern] v1.0.0
First-visit page load animation sequence: prevent FOUC with initial hidden state, stagger-reveal content blocks after paint, and skip the animation on return visits using sessionStorage.
Loaded when retrieval picks the atom as adjacent / supporting.
PageLoadChoreography [pattern] v1.0.0
First-visit page load animation sequence: prevent FOUC with initial hidden state, stagger-reveal content blocks after paint, and skip the animation on return visits using sessionStorage.
Structure
- HTML: critical elements start as opacity:0 via .js-hidden class set immediately
- CSS: .reveal transition opacity 0→1, translateY 12px→0, duration 400ms, stagger via animation-delay
- JS: after DOMContentLoaded, check sessionStorage.getItem('visited') — if set, skip animation entirely
- JS: if first visit, add .reveal class to elements with 80ms delay between each, then set sessionStorage
- Reduced motion: wrap the reveal animation in @media (prefers-reduced-motion: no-preference)
Css Skeleton
.js-hidden { opacity: 0; transform: translateY(12px); }
@media (prefers-reduced-motion: no-preference) {
.reveal {
animation: fadeUp 400ms ease-out forwards;
}
}
@keyframes fadeUp {
to { opacity: 1; transform: translateY(0); }
}
/* Stagger via nth-child or explicit delay */
.hero { animation-delay: 0ms; }
.nav { animation-delay: 80ms; }
.body { animation-delay: 160ms; }
Loaded when retrieval picks the atom as a focal / direct hit.
PageLoadChoreography [pattern] v1.0.0
First-visit page load animation sequence: prevent FOUC with initial hidden state, stagger-reveal content blocks after paint, and skip the animation on return visits using sessionStorage.
Structure
- HTML: critical elements start as opacity:0 via .js-hidden class set immediately
- CSS: .reveal transition opacity 0→1, translateY 12px→0, duration 400ms, stagger via animation-delay
- JS: after DOMContentLoaded, check sessionStorage.getItem('visited') — if set, skip animation entirely
- JS: if first visit, add .reveal class to elements with 80ms delay between each, then set sessionStorage
- Reduced motion: wrap the reveal animation in @media (prefers-reduced-motion: no-preference)
Css Skeleton
.js-hidden { opacity: 0; transform: translateY(12px); }
@media (prefers-reduced-motion: no-preference) {
.reveal {
animation: fadeUp 400ms ease-out forwards;
}
}
@keyframes fadeUp {
to { opacity: 1; transform: translateY(0); }
}
/* Stagger via nth-child or explicit delay */
.hero { animation-delay: 0ms; }
.nav { animation-delay: 80ms; }
.body { animation-delay: 160ms; }
Rationale
Choreographed first-paint entry communicates product quality and gives the eye a focal point during load. Return visitors should never re-watch the intro — that becomes friction.
Structure
- HTML: critical elements start as opacity:0 via .js-hidden class set immediately
- CSS: .reveal transition opacity 0→1, translateY 12px→0, duration 400ms, stagger via animation-delay
- JS: after DOMContentLoaded, check sessionStorage.getItem('visited') — if set, skip animation entirely
- JS: if first visit, add .reveal class to elements with 80ms delay between each, then set sessionStorage
- Reduced motion: wrap the reveal animation in @media (prefers-reduced-motion: no-preference)
Css Skeleton
.js-hidden { opacity: 0; transform: translateY(12px); }
@media (prefers-reduced-motion: no-preference) {
.reveal {
animation: fadeUp 400ms ease-out forwards;
}
}
@keyframes fadeUp {
to { opacity: 1; transform: translateY(0); }
}
/* Stagger via nth-child or explicit delay */
.hero { animation-delay: 0ms; }
.nav { animation-delay: 80ms; }
.body { animation-delay: 160ms; }
Source
prime-system/examples/frontend-design/primes/compiled/@community/pattern-page-load-choreography/atom.yaml