Follow-up from PR #629
The current page flip uses a simple rotateY(-90deg) which rotates the content off-screen. We want a more realistic book page turning effect where:
- The outgoing page visually lifts and curls from the edge like a physical paper page
- The incoming (next) page is visible underneath as the outgoing page turns
- A shadow follows the turning page to add depth
Reference
See the attached screenshot of a PDF reader — the page physically turns and reveals the next page behind it, with shadows along the fold line.
Requirements
Two-phase page turn:
-
Phase 1 (outgoing page flips away): The current page starts flat, then rotates around the Y-axis from the right edge (for Next) or left edge (for Prev). As it rotates, a shadow appears along the fold. The page should have backface-visibility: hidden so you don't see reversed content.
-
Phase 2 (incoming page revealed): The next page content is already positioned underneath (z-index behind). As the outgoing page lifts away, the incoming page is progressively revealed. The incoming page can have a subtle fade-in or slide-in from slightly offset.
Implementation approach:
Stack both pages (outgoing on top, incoming below):
.page-container {
position: relative;
perspective: 1500px;
}
.page-outgoing {
position: absolute;
transform-origin: left center; /* for "Next" */
animation: flip-out 500ms ease-in forwards;
backface-visibility: hidden;
z-index: 2;
}
.page-incoming {
z-index: 1;
animation: fade-in 500ms ease-out;
}
@keyframes flip-out {
0% { transform: rotateY(0deg); box-shadow: none; }
50% { box-shadow: -10px 0 30px rgba(0,0,0,0.2); }
100% { transform: rotateY(-120deg); box-shadow: none; }
}
Key details:
- Both pages must be in the DOM simultaneously during the transition
- The outgoing page captures the previous content (can use a snapshot or keep the previous content in state)
- The shadow should move with the page fold
- Duration: ~500ms ease-in-out
- Must work on both swipe and button/keyboard navigation
- CSS-only animation (no JS animation libraries)
- Mobile performance: use
will-change: transform and GPU-accelerated properties only
Files to modify
src/components/ReadingMode.tsx — two-phase render with outgoing/incoming pages
src/app/globals.css — updated keyframes with shadow and backface
Branch
task/623-reading-mode-page-flip-v2 (same branch, follow-up)
Acceptance criteria
Self-Verification (T3)
Follow-up from PR #629
The current page flip uses a simple
rotateY(-90deg)which rotates the content off-screen. We want a more realistic book page turning effect where:Reference
See the attached screenshot of a PDF reader — the page physically turns and reveals the next page behind it, with shadows along the fold line.
Requirements
Two-phase page turn:
Phase 1 (outgoing page flips away): The current page starts flat, then rotates around the Y-axis from the right edge (for Next) or left edge (for Prev). As it rotates, a shadow appears along the fold. The page should have
backface-visibility: hiddenso you don't see reversed content.Phase 2 (incoming page revealed): The next page content is already positioned underneath (z-index behind). As the outgoing page lifts away, the incoming page is progressively revealed. The incoming page can have a subtle fade-in or slide-in from slightly offset.
Implementation approach:
Stack both pages (outgoing on top, incoming below):
Key details:
will-change: transformand GPU-accelerated properties onlyFiles to modify
src/components/ReadingMode.tsx— two-phase render with outgoing/incoming pagessrc/app/globals.css— updated keyframes with shadow and backfaceBranch
task/623-reading-mode-page-flip-v2(same branch, follow-up)Acceptance criteria
Self-Verification (T3)
npm run dev, navigate to a story with multiple plotsbackface-visibility: hidden— no reversed text visible during flipnpm run build— no errors