Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

feat: Page Curl (03.15)

matina65c52198727
diff --git a/README.md b/README.md
index 8547c903..d2bb7b0c 100644
--- a/README.md
+++ b/README.md
@@ -117,6 +117,7 @@ All 129 techniques, each linked to its live demo.
- **[FLIP Technique](animations/03-page-transitions/flip-technique/)** — Cards glide to their new places when the layout changes. Best for sorting lists.
- **[Circle Reveal](animations/03-page-transitions/circle-reveal/)** — The next page grows in a circle from the spot you click. Best for app-style navigation.
- **[Overlay Wipe](animations/03-page-transitions/overlay-wipe/)** — A colored panel sweeps over the page, which changes behind it. Best for portfolio sites.
+- **[Page Curl](animations/03-page-transitions/page-curl/)** — The page peels back from its corner like paper to show the next. Best for digital magazines.
</details>
diff --git a/animations/03-page-transitions/README.md b/animations/03-page-transitions/README.md
index 0ffa9e9b..31bdab73 100644
--- a/animations/03-page-transitions/README.md
+++ b/animations/03-page-transitions/README.md
@@ -18,3 +18,4 @@ Full-page transitions between routes or views — how one screen gives way to th
- [FLIP Technique](flip-technique/) — Cards glide to their new places when the layout changes. Best for sorting lists.
- [Circle Reveal](circle-reveal/) — The next page grows in a circle from the spot you click. Best for app-style navigation.
- [Overlay Wipe](overlay-wipe/) — A colored panel sweeps over the page, which changes behind it. Best for portfolio sites.
+- [Page Curl](page-curl/) — The page peels back from its corner like paper to show the next. Best for digital magazines.
diff --git a/animations/03-page-transitions/overlay-wipe/index.html b/animations/03-page-transitions/overlay-wipe/index.html
index 53e97370..cfa28f85 100644
--- a/animations/03-page-transitions/overlay-wipe/index.html
+++ b/animations/03-page-transitions/overlay-wipe/index.html
@@ -57,7 +57,7 @@
<body class="hb" data-hb-kind="do" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
<a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../circle-reveal/" rel="prev" aria-label="Previous: Circle Reveal"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Circle Reveal</span></a></span>
+ <span class="hb-pager"><a href="../circle-reveal/" rel="prev" aria-label="Previous: Circle Reveal"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Circle Reveal</span></a><a href="../page-curl/" rel="next" aria-label="Next: Page Curl"><span><span class="hb-dir">Next: </span>Page Curl</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a></span>
</nav>
<main class="hb-page">
<header class="hb-head">
diff --git a/animations/03-page-transitions/page-curl/README.md b/animations/03-page-transitions/page-curl/README.md
new file mode 100644
index 00000000..4dcb889a
--- /dev/null
+++ b/animations/03-page-transitions/page-curl/README.md
@@ -0,0 +1,46 @@
+# Page Curl
+
+## What it is
+A page curl turns a page over like a sheet of paper. Its bottom corner lifts and travels to the left, the part that has lifted lies folded over the page as the back of the sheet, and the next page shows underneath until the whole sheet has turned away. Going back runs it in reverse: the earlier page comes over from the left and lays itself down.
+
+## When to use it
+- Digital magazines, catalogs and picture books, where the page itself is the content
+- Restaurant menus, brochures and photo albums that imitate a printed original
+- Story or onboarding screens that are read one page at a time
+- Any reader where the visitor should feel they are moving through a book rather than between screens
+
+## How it works
+The page that turns sits on top of the next one. On every frame, its bottom-right corner is placed on a path that runs to the left and rises on the way. The fold is the line halfway between where the corner started and where it is now: the part of the page before the fold stays flat, and the part past it is mirrored over the fold to make the flap. All three shapes are polygons for `clip-path`, cut from the page's rectangle with one Sutherland-Hodgman step:
+
+```js
+const w=area.clientWidth,h=area.clientHeight,c={x:w-2*w*p,y:h-.8*h*Math.sin(Math.PI*p)};
+const dx=w-c.x,dy=h-c.y,len=Math.hypot(dx,dy),box=[{x:0,y:0},{x:w,y:0},{x:w,y:h},{x:0,y:h}];
+const n={x:dx/len,y:dy/len},m={x:(w+c.x)/2,y:(h+c.y)/2},past=q=>(q.x-m.x)*n.x+(q.y-m.y)*n.y;
+const lifted=cut(box,past); // the part that has lifted off the page
+sheet.style.clipPath=poly(cut(box,q=>-past(q))); // the flat part of the turning page
+flap.style.clipPath=poly(lifted.map(q=>({x:q.x-2*past(q)*n.x,y:q.y-2*past(q)*n.y}))); // mirrored over the fold
+shade.style.clipPath=poly(lifted); // the shadow on the page underneath
+```
+
+The flap is a box the color of the back of the sheet. Its shading is a `linear-gradient` turned to the fold's angle, with its stops measured in pixels from the fold: dark where the paper bends, a light band where it faces the light. The shadow box lies between the two pages and darkens the page underneath next to the fold. The progress `p` comes from the time since the turn began, eased in and out, so the turn takes the same time at any frame rate; a turn back runs `p` from 1 down to 0 with the earlier page as the sheet.
+
+## Key parameters
+| Parameter | Default | Effect |
+|-----------|---------|--------|
+| Turn speed | Normal | How long one page takes to turn over: slow is 1500ms, normal 1000ms and fast 650ms |
+| Which way it turns | Forward and back | Forward and back turns the page away for a later page and lays an earlier page back down; the other two always turn one way |
+| Paper shading | Soft | How strongly the fold is shaded and how dark the shadow on the page below is; off leaves a flat paper back |
+
+## Production notes
+- **A straight fold is a good fake.** Real paper bends in a curve, which needs a mesh in WebGL or many thin strips. A straight fold with a gradient across the flap reads as a curl at a fraction of the cost.
+- **`clip-path` repaints.** The three polygons change every frame, so the browser repaints the turning page; keep it to a few layers and avoid heavy filters on them. Measure the box on every frame (or on resize), never once at load.
+- **Move by elapsed time.** The progress is the time since the turn began divided by its length, never a fixed step per frame, so the turn is as long on a 120 Hz screen as on a 30 Hz phone.
+- **Let people drag it.** In a reader, tie `p` to a pointer drag from the corner (Pointer Events, so touch works too) and let go to finish or undo the turn.
+- **Reduced motion** fades the new page in over 300ms instead; nothing turns.
+- **Library equivalents.** turn.js and StPageFlip build book-style page turns from CSS transforms or a canvas; Three.js page-curl shaders bend the page in real 3D. All of them use the same corner-and-fold idea.
+
+## See also
+- [3D Flip Card](../../06-3d-advanced/flip-card-3d/) — a card turns over in 3D to show its back
+- [Slide Transition](../slide-transition/) — pages move sideways instead
+- [Overlay Wipe](../overlay-wipe/) — a colored panel hides the change instead
+- [Crossfade Transition](../crossfade/) — the plain fade it falls back to
diff --git a/animations/03-page-transitions/page-curl/index.html b/animations/03-page-transitions/page-curl/index.html
new file mode 100644
index 00000000..8c21b914
--- /dev/null
+++ b/animations/03-page-transitions/page-curl/index.html
@@ -0,0 +1,301 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Page Curl — Animation Handbook</title>
+ <meta name="description" content="The page peels back from its corner like paper to show the next. Best for digital magazines.">
+ <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/page-curl/">
+ <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
+ <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
+ <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
+ <meta property="og:type" content="article">
+ <meta property="og:site_name" content="Animation Handbook">
+ <meta property="og:title" content="Page Curl — Animation Handbook">
+ <meta property="og:description" content="The page peels back from its corner like paper to show the next. Best for digital magazines.">
+ <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/page-curl/">
+ <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
+ <meta name="twitter:card" content="summary_large_image">
+ <meta name="twitter:title" content="Page Curl — Animation Handbook">
+ <meta name="twitter:description" content="The page peels back from its corner like paper to show the next. Best for digital magazines.">
+ <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Page Curl", "name": "Page Curl", "description": "The page peels back from its corner like paper to show the next. Best for digital magazines.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/page-curl/", "inLanguage": "en", "articleSection": "Page Transitions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Page Transitions, Page Curl"}</script>
+ <style>
+ :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#b98cff;--ui-text:#f4f4f2;--ui-muted:#8a8a92}
+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
+ .stage{display:flex;flex-direction:column;overflow:hidden;background:var(--bg);color:var(--ui-text)}
+ .mini-nav{display:flex;gap:6px;padding:10px 12px;background:var(--ui-bg);border-bottom:1px solid var(--ui-border);flex-shrink:0}
+ .nav-btn{background:none;border:1px solid var(--ui-border);color:var(--ui-muted);font:inherit;font-size:13px;padding:0 12px;border-radius:4px;cursor:pointer;min-height:44px}
+ .nav-btn.active{border-color:var(--ui-accent);color:var(--ui-accent)}
+ @media(hover:hover){.nav-btn:hover{border-color:var(--ui-accent)}}
+ .page-area{flex:1;position:relative;overflow:hidden;background:#060608}
+ .page{position:absolute;inset:0;opacity:0;pointer-events:none}
+ .page.active{opacity:1;pointer-events:auto}
+ /* While a page turns: the shadow lies on the page underneath, the flap (the back of the turning sheet) on top of everything */
+ .shade,.flap{position:absolute;inset:0;display:none;pointer-events:none}.shade{z-index:2}.flap{z-index:4}.turning .shade,.turning .flap{display:block}
+ /* page content */
+ .pc{display:flex;flex-direction:column;justify-content:center;height:100%;padding:clamp(20px,4vw,40px);gap:12px}
+ .pe{font-size:10px;text-transform:uppercase;letter-spacing:3px;opacity:.6}
+ .ph{font-size:clamp(22px,3.5vw,36px);font-weight:bold;line-height:1.15}
+ .pp{font-size:12px;opacity:.6;line-height:1.65;max-width:320px}
+ .pgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:4px}
+ .gi{background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.1);border-radius:6px;padding:18px 12px;font-size:11px}
+ .pstat{display:flex;gap:20px;margin-top:4px}
+ .pstat b{display:block;font-size:clamp(18px,2.5vw,24px);color:var(--ui-accent)}
+ .pstat span{font-size:9px;opacity:.6;text-transform:uppercase;letter-spacing:1px}
+ /* Short windows leave the page area under 220px: tighter spacing keeps the tallest page inside it with room to spare */
+ @media(max-height:640px){.pc{gap:8px}.gi{padding:12px}}
+ </style>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=6">
+ <script src="../../../assets/js/demo-page.js?v=6" defer></script>
+</head>
+<body class="hb" data-hb-kind="do" data-hb-autoplay>
+<nav class="hb-bar" aria-label="Animation Handbook">
+ <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
+ <span class="hb-pager"><a href="../overlay-wipe/" rel="prev" aria-label="Previous: Overlay Wipe"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Overlay Wipe</span></a></span>
+</nav>
+<main class="hb-page">
+ <header class="hb-head">
+ <p class="hb-cat">03.15 · Page Transitions</p>
+ <h1>Page Curl</h1>
+ <p class="hb-lede">The page peels back from its corner like paper to show the next. Best for digital magazines.</p>
+ </header>
+
+ <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
+ <div class="hb-step-head">
+ <span class="hb-num" aria-hidden="true">1</span>
+ <div><h2 id="hb-watch-title">Click it</h2><p>Click Work or About at the top of the box, or press Show me.</p></div>
+ </div>
+ <div class="stage">
+ <nav class="mini-nav" id="nav" aria-label="Demo pages"></nav>
+ <div class="page-area" id="page-area"><div class="shade" id="shade"></div><div class="flap" id="flap"></div></div>
+ </div>
+ <div class="hb-player">
+ <button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>
+ <button class="hb-play" type="button" id="btn-reset" data-hb-reset><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Reset</button>
+ <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
+ </div>
+ </section>
+
+ <section class="hb-step hb-try" aria-labelledby="hb-try-title">
+ <div class="hb-step-head">
+ <span class="hb-num" aria-hidden="true">2</span>
+ <div><h2 id="hb-try-title">Try it</h2><p>Change a setting, then try it again or press Show me.</p></div>
+ </div>
+ <div class="hb-settings">
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="speed-lbl">Turn speed</p>
+ <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">
+ <button type="button" data-ms="1500" aria-pressed="false">Slow</button>
+ <button type="button" data-ms="1000" class="on" aria-pressed="true">Normal</button>
+ <button type="button" data-ms="650" aria-pressed="false">Fast</button>
+ </div>
+ <p class="hb-hint">How long one page takes to turn over.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="way-lbl">Which way it turns</p>
+ <div class="seg" id="way-seg" role="group" aria-labelledby="way-lbl">
+ <button type="button" data-way="both" class="on" aria-pressed="true">Forward and back</button>
+ <button type="button" data-way="fwd" aria-pressed="false">Always forward</button>
+ <button type="button" data-way="back" aria-pressed="false">Always back</button>
+ </div>
+ <p class="hb-hint">Back lays an earlier page down over the one you are on.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="shade-lbl">Paper shading</p>
+ <div class="seg" id="shade-seg" role="group" aria-labelledby="shade-lbl">
+ <button type="button" data-k="0" aria-pressed="false">Off</button>
+ <button type="button" data-k="0.6" class="on" aria-pressed="true">Soft</button>
+ <button type="button" data-k="1" aria-pressed="false">Strong</button>
+ </div>
+ <p class="hb-hint">Shading makes the folded paper look curved.</p>
+ </div>
+ </div>
+ </section>
+
+ <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
+ <div class="hb-step-head">
+ <span class="hb-num" aria-hidden="true">3</span>
+ <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
+ </div>
+ <div class="hb-card">
+ <p class="hb-prompt">Add a page curl to [the pages you want to turn, such as a magazine]. When the visitor goes to the next page, lift the bottom corner of the current page and turn it over to the left like paper, so the next page shows underneath. Draw the folded part as the back of the sheet, lying over the page along a straight fold that moves with the corner. A turn back runs the same movement in reverse. Paper shading darkens the fold and casts a soft shadow on the page below. Work out the fold from the corner's position on every frame and time the turn by elapsed time. If the visitor has reduced motion turned on, fade between the pages instead. Match the settings listed below.</p>
+ <div class="hb-chips-box" hidden>
+ <p class="hb-chips-title">Your settings</p>
+ <ul class="hb-chips"></ul>
+ </div>
+ <div class="hb-copy-row">
+ <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
+ <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
+ </div>
+ </div>
+ </section>
+
+ <section class="hb-about" aria-labelledby="hb-what-title">
+ <div class="hb-what">
+ <h2 id="hb-what-title">What it is</h2>
+ <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
+ </div>
+ <div class="hb-fit">
+ <h2>Good for</h2>
+ <ul class="hb-tags hb-good"><li>Digital magazines</li><li>Picture books</li><li>Menus and brochures</li><li>Photo albums</li></ul>
+ <h3>Avoid on</h3>
+ <ul class="hb-tags hb-avoid"><li>Everyday navigation</li></ul>
+ </div>
+ </section>
+
+ <section class="hb-related" aria-labelledby="hb-related-title" hidden>
+ <h2 id="hb-related-title">Similar animations</h2>
+ <div class="hb-rel-list"></div>
+ </section>
+</main>
+<footer class="hb-foot"><span>Animation Handbook</span><a href="#top">Back to top ↑</a></footer>
+<script>
+ // back: the color of the back of each sheet, seen on the flap while it turns
+ const PAGES=[
+ {name:'Home',bg:'linear-gradient(135deg,#0d1a2e,#192640)',back:'#b7c3dc',html:`<div class="pc"><div class="pe">Creative Studio</div><p class="ph">Design without compromise.</p><p class="pp">We craft digital products that earn attention and keep it. Every pixel considered.</p></div>`},
+ {name:'Work',bg:'linear-gradient(135deg,#0d1f15,#152e1e)',back:'#b5cfbb',html:`<div class="pc"><div class="pe">Selected Work</div><p class="ph">The Portfolio</p><div class="pgrid">${['Atlas','Orbit','Prism','Lumen','Frame','Echo'].map(n=>`<div class="gi">${n}</div>`).join('')}</div></div>`},
+ {name:'About',bg:'linear-gradient(135deg,#1f0d26,#2e1540)',back:'#cbb8dc',html:`<div class="pc"><div class="pe">Our Story</div><p class="ph">Built on conviction.</p><p class="pp">18 people who care unreasonably about craft. Independent since 2016.</p><div class="pstat"><div><b>140+</b><span>Projects</span></div><div><b>9</b><span>Years</span></div><div><b>3</b><span>Continents</span></div></div></div>`},
+ ];
+ const nav=document.getElementById('nav'),area=document.getElementById('page-area'),shade=document.getElementById('shade'),flap=document.getElementById('flap'),slowTog=document.getElementById('slow-tog');
+ const motionOk=!window.matchMedia('(prefers-reduced-motion:reduce)').matches;
+ let current=0,animating=false,dur=1000,way='both',k=.6,raf=0,afterMove=null,wayBack=0,timers=[];
+ const pages=[],navBtns=[];
+
+ PAGES.forEach((p,i)=>{
+ const d=document.createElement('div');d.className='page';d.style.background=p.bg;d.innerHTML=p.html;area.insertBefore(d,shade);pages.push(d);
+ const b=document.createElement('button');b.type='button';b.className='nav-btn';b.textContent=p.name;
+ b.addEventListener('click',()=>navigate(i));nav.appendChild(b);navBtns.push(b);
+ });
+
+ // Drops a timer's id once it fires, so `timers` only holds the ones still waiting.
+ function later(fn,wait){
+ const id=setTimeout(()=>{
+ const i=timers.indexOf(id);
+ if(i>-1)timers.splice(i,1);
+ fn();
+ },wait);
+ timers.push(id);
+ return id;
+ }
+ function cancel(id){
+ clearTimeout(id);
+ const i=timers.indexOf(id);
+ if(i>-1)timers.splice(i,1);
+ }
+
+ function updateNav(n){navBtns.forEach((b,i)=>{b.classList.toggle('active',i===n);b.setAttribute('aria-current',i===n?'page':'false')})}
+ // One page's resting look: its class alone shows or hides it, with no clip, fade or stacking left over (its background stays).
+ // A page that is not shown is also out of the Tab order and the accessibility tree (inert).
+ function rest(el,on){
+ el.classList.toggle('active',on);
+ el.inert=!on;
+ el.style.clipPath='';el.style.zIndex='';el.style.transition='';el.style.opacity='';
+ }
+ // The resting state for page n, at once: no turn or fade left running
+ function showPage(n){
+ cancelAnimationFrame(raf);raf=0;area.classList.remove('turning');
+ pages.forEach((el,i)=>{rest(el,i===n);el.getAnimations().forEach(a=>a.cancel())});
+ updateNav(n);
+ }
+
+ // Ends a change: the demo is idle again, and a Show me run goes on to its next step
+ function finish(){
+ animating=false;
+ const then=afterMove;afterMove=null;
+ if(then)then();
+ }
+ // Stops everything at once and shows the resting state for `current`
+ function settle(){
+ timers.forEach(clearTimeout);timers=[];wayBack=0;afterMove=null;
+ animating=false;
+ showPage(current);
+ }
+
+ // The part of polygon `pts` where side(point) >= 0: one edge of a Sutherland-Hodgman clip
+ function cut(pts,side){
+ const out=[];
+ pts.forEach((a,i)=>{
+ const b=pts[(i+1)%pts.length],sa=side(a),sb=side(b);
+ if(sa>=0)out.push(a);
+ if((sa>=0)!==(sb>=0)){const t=sa/(sa-sb);out.push({x:a.x+(b.x-a.x)*t,y:a.y+(b.y-a.y)*t})}
+ });
+ return out;
+ }
+ const poly=pts=>pts.length<3?'polygon(0 0,0 0,0 0)':'polygon('+pts.map(q=>q.x.toFixed(1)+'px '+q.y.toFixed(1)+'px').join(',')+')';
+
+ // The sheet on top at progress p (0 flat, 1 turned away to the left). Its bottom-right corner moves to C, rising on the way;
+ // the fold is the line halfway between where the corner was and C. What lies past the fold is mirrored over it: the flap.
+ function curl(sheet,p){
+ const w=area.clientWidth,h=area.clientHeight,c={x:w-2*w*p,y:h-.8*h*Math.sin(Math.PI*p)};
+ const dx=w-c.x,dy=h-c.y,len=Math.hypot(dx,dy),box=[{x:0,y:0},{x:w,y:0},{x:w,y:h},{x:0,y:h}];
+ if(len<.5){sheet.style.clipPath='';flap.style.clipPath=shade.style.clipPath=poly([]);return}
+ const n={x:dx/len,y:dy/len},m={x:(w+c.x)/2,y:(h+c.y)/2},past=q=>(q.x-m.x)*n.x+(q.y-m.y)*n.y;
+ const lifted=cut(box,past);
+ sheet.style.clipPath=poly(cut(box,q=>-past(q)));
+ flap.style.clipPath=poly(lifted.map(q=>({x:q.x-2*past(q)*n.x,y:q.y-2*past(q)*n.y})));
+ shade.style.clipPath=poly(lifted);
+ // Gradients that start at the fold: its distance along a gradient line at this angle, and how far the flap reaches
+ const deg=Math.atan2(n.x,-n.y)*180/Math.PI,line=Math.abs(w*n.x)+Math.abs(h*n.y),at=(m.x-w/2)*n.x+(m.y-h/2)*n.y+line/2;
+ const f=line-at,reach=Math.max(...box.map(past)),dark=a=>`rgba(0,0,0,${(a*k).toFixed(3)})`;
+ flap.style.backgroundImage=`linear-gradient(${deg+180}deg,${dark(.5)} ${f}px,${dark(0)} ${f+Math.min(reach*.35,70)}px,rgba(255,255,255,${(.25*k).toFixed(3)}) ${f+reach*.7}px,${dark(.18)} ${f+reach}px)`;
+ shade.style.backgroundImage=`linear-gradient(${deg}deg,${dark(.7*Math.sqrt(Math.sin(Math.PI*p)))} ${at}px,${dark(0)} ${at+Math.min(w,h)*.22}px)`;
+ }
+
+ function navigate(next,then){
+ if(next===current||animating)return;
+ const prev=current;current=next;updateNav(next);
+ afterMove=then||null;animating=true;
+ const oldEl=pages[prev],newEl=pages[next];
+ newEl.classList.add('active'); // both pages are on show while the sheet turns
+ if(!motionOk){
+ // Reduced motion: the new page fades in over the old one, nothing turns
+ newEl.style.zIndex='3';newEl.style.opacity='0';newEl.offsetHeight;
+ newEl.style.transition='opacity 300ms linear';newEl.style.opacity='1';
+ later(()=>{rest(oldEl,false);rest(newEl,true);finish()},350);
+ return;
+ }
+ // Forward: the old page turns away from over the new one. Back: the new page is laid down over the old one.
+ const fwd=way==='fwd'||(way==='both'&&next>prev),sheet=fwd?oldEl:newEl,d=dur*(slowTog.checked?3:1);
+ (fwd?newEl:oldEl).style.zIndex='1';sheet.style.zIndex='3';
+ flap.style.backgroundColor=PAGES[fwd?prev:next].back;
+ area.classList.add('turning');
+ curl(sheet,fwd?0:1);
+ let start=null;
+ // The turn moves by elapsed time (eased in and out), so it takes d ms at any frame rate
+ const frame=ts=>{
+ if(start===null)start=ts;
+ const t=Math.min((ts-start)/d,1),e=t<.5?4*t*t*t:1-Math.pow(2-2*t,3)/2;
+ curl(sheet,fwd?e:1-e);
+ if(t<1)raf=requestAnimationFrame(frame);else{raf=0;area.classList.remove('turning');rest(oldEl,false);rest(newEl,true);finish()}
+ };
+ raf=requestAnimationFrame(frame);
+ }
+
+ // Show me: one visit to the next page, a hold of 1200ms, and the way back to where the run started
+ function showMe(){
+ settle();
+ const start=current;
+ navigate((start+1)%PAGES.length,()=>{wayBack=later(()=>{wayBack=0;navigate(start)},1200)});
+ }
+ function reset(){current=0;settle()}
+
+ document.getElementById('btn-demo').addEventListener('click',showMe);
+ document.getElementById('btn-reset').addEventListener('click',reset);
+ // The visitor took over: cancel what the run has not started yet. A turn already under way finishes on its own.
+ document.addEventListener('hb:input',()=>{afterMove=null;cancel(wayBack);wayBack=0});
+
+ function choices(id,pick){
+ const buttons=document.querySelectorAll('#'+id+' button');
+ buttons.forEach(b=>b.addEventListener('click',()=>{
+ buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
+ pick(b.dataset);
+ }));
+ }
+ choices('speed-seg',d=>{dur=+d.ms});
+ choices('way-seg',d=>{way=d.way});
+ choices('shade-seg',d=>{k=+d.k});
+ showPage(0);
+</script>
+</body>
+</html>
diff --git a/index.html b/index.html
index 95d67728..1df06861 100644
--- a/index.html
+++ b/index.html
@@ -639,6 +639,20 @@ button,input{font:inherit;color:inherit}
@keyframes p-ow1{0%,10%{transform:translateX(-101%)}25%,31%{transform:translateX(0)}46%,100%{transform:translateX(101%)}}
@keyframes p-ow2{0%,60%{transform:translateX(-101%)}75%,81%{transform:translateX(0)}96%,100%{transform:translateX(101%)}}
@keyframes p-owb{0%,27.9%{opacity:0}28%,77.9%{opacity:1}78%,100%{opacity:0}}
+.pv-pcurl{background:#0c0d12;position:relative;overflow:hidden}
+.pv-pcurl .pg{position:absolute;left:14%;right:34%;top:38%;display:flex;flex-direction:column;gap:9px}
+.pv-pcurl .pg b{height:8px;border-radius:2px;background:color-mix(in srgb,var(--accent) 24%,#1c1e26)}
+.pv-pcurl .pg b:first-child{width:64%;height:14px}.pv-pcurl .pg b:last-child{width:82%}
+.pv-pcurl .pb{opacity:0;animation:p-pcb 4s ease infinite}
+.pv-pcurl .pb b{background:var(--accent)}
+/* The corner peel: the uncovered corner of the next page and the folded flap keep one shape (a fold at a fixed slant on the 16:10
+ stage, the flap its mirror over the fold) and only grow from the bottom-right corner */
+.pv-pcurl .nb,.pv-pcurl .fl{position:absolute;inset:0;transform-origin:100% 100%;transform:scale(0)}
+.pv-pcurl .nb{clip-path:polygon(100% 100%,100% 0,18.75% 100%);background:linear-gradient(142deg,rgba(0,0,0,.6) 55%,rgba(0,0,0,0) 70%),color-mix(in srgb,var(--accent) 16%,#0e0f15);animation:p-pcn 4s ease-in-out infinite}
+.pv-pcurl .fl{clip-path:polygon(100% 0,18.75% 100%,39.6% -25.7%);background:linear-gradient(322deg,color-mix(in srgb,var(--accent) 28%,#4a4f5e) 45%,color-mix(in srgb,var(--accent) 22%,#c9cdd8) 58%,color-mix(in srgb,var(--accent) 14%,#eef0f5) 76%,color-mix(in srgb,var(--accent) 24%,#a9aebd) 90%);animation:p-pcf 4s ease-in-out infinite}
+@keyframes p-pcn{0%,12%{transform:scale(0);opacity:1}40%,48%{transform:scale(.55)}70%,92%{transform:scale(2.4);opacity:1}100%{transform:scale(2.4);opacity:0}}
+@keyframes p-pcf{0%,12%{transform:scale(0)}40%,48%{transform:scale(.55)}70%,100%{transform:scale(2.4)}}
+@keyframes p-pcb{0%,70%{opacity:0}80%,92%{opacity:1}100%{opacity:0}}
/* ── bespoke: 04 Micro-Interactions ── */
.pv-hoverbtn,.pv-press{background:#08090c;display:grid;place-items:center}
@@ -1029,7 +1043,7 @@ button,input{font:inherit;color:inherit}
<section class="wrap home-hero" aria-labelledby="hero-title">
<span class="float fl1" aria-hidden="true"></span><span class="float fl2" aria-hidden="true"></span><span class="float fl3" aria-hidden="true"></span>
<span class="float fl4" aria-hidden="true"></span><span class="float fl5" aria-hidden="true"></span><span class="float fl6" aria-hidden="true"></span>
- <p class="pill"><span class="pill-dot" aria-hidden="true"></span>131 free animations · no coding needed</p>
+ <p class="pill"><span class="pill-dot" aria-hidden="true"></span>132 free animations · no coding needed</p>
<h1 class="h1" id="hero-title">What do you want to animate?</h1>
<p class="sub">Pick a place, or describe it in your own words. Every animation plays live, and each one comes with a ready-made prompt for your AI assistant.</p>
<form class="search" id="search-form" role="search" action="./" method="get">
@@ -1086,8 +1100,8 @@ button,input{font:inherit;color:inherit}
<p class="empty-s">Try a simpler word, or pick one of these:</p>
<p class="pop"><button type="button" data-q="fade in">fade in</button><button type="button" data-q="typing text">typing text</button><button type="button" data-q="loading spinner">loading spinner</button><button type="button" data-q="parallax">parallax</button><button type="button" data-q="confetti">confetti</button></p>
</div>
- <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 131 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>
- <noscript><p class="noscript">This page shows its animations with JavaScript. All 131 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
+ <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 132 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>
+ <noscript><p class="noscript">This page shows its animations with JavaScript. All 132 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
</section>
<section class="how" id="how" aria-labelledby="how-title">
@@ -1105,7 +1119,7 @@ button,input{font:inherit;color:inherit}
<footer class="wrap foot">
<a class="brand" href="./"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><circle class="ring" cx="11.16" cy="20.84" r="6.1"/><circle class="ring" cx="15.12" cy="16.88" r="6.1"/><circle class="ring" cx="18.51" cy="13.49" r="6.1"/><circle class="ball" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <p class="foot-t">131 web animations with live demos and copyable prompts.</p>
+ <p class="foot-t">132 web animations with live demos and copyable prompts.</p>
<nav class="nav" aria-label="Footer"><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener noreferrer">GitHub</a><a class="lnk" href="#top">Back to top</a></nav>
</footer>
<div class="toast" id="toast" role="status" aria-live="polite"><span class="ok" aria-hidden="true"><svg class="i" viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="toast-t"></span></div>
@@ -1193,6 +1207,7 @@ const CATS=[
['flip-technique','FLIP Technique','Cards glide to their new places when the layout changes. Best for sorting lists.'],
['circle-reveal','Circle Reveal','The next page grows in a circle from the spot you click. Best for app-style navigation.'],
['overlay-wipe','Overlay Wipe','A colored panel sweeps over the page, which changes behind it. Best for portfolio sites.'],
+ ['page-curl','Page Curl','The page peels back from its corner like paper to show the next. Best for digital magazines.'],
]
},
{
@@ -1321,7 +1336,7 @@ const PV={
'view-transitions-api':'vt','shared-element-transition':'shared','morph-transition':'morph','crossfade':'xfade',
'slide-transition':'slidepage','zoom-transition':'zoompage','flash-transition':'flash','blur-transition':'blurpage',
'elastic-transition':'elastic','portal-zoom':'portal','dissolve':'dissolve','flip-technique':'flip',
- 'circle-reveal':'circlerev','overlay-wipe':'owipe',
+ 'circle-reveal':'circlerev','overlay-wipe':'owipe','page-curl':'pcurl',
'click-ripple':'ripple','loading-spinner':'spinner','shimmer-effect':'shimmer','skeleton-loader':'shimmer',
'hover-state':'hoverbtn','focus-ring':'focusring','button-press-scale':'press','toggle-switch':'toggle',
'progress-animation':'segbar','checkmark-draw':'check','form-field-morph':'floatlabel','badge-pulse':'badge',
@@ -1402,6 +1417,7 @@ const PLACES={
'flip-technique':['page','imgcard'],
'circle-reveal':['page'],
'overlay-wipe':['page'],
+ 'page-curl':['page','imgcard'],
// 04
'hover-state':['btn','imgcard'],
'click-ripple':['btn'],
@@ -1494,6 +1510,7 @@ function pvMarkup(k){
case 'sig2': return '<span class="s2 anim"></span>';
case 'sig3': return '<span class="s3 pa anim"></span><span class="s3 pb anim"></span>';
case 'circlerev': return '<span class="pg"><b></b><b></b><b></b></span><span class="c anim"></span><span class="pg pb anim"><b></b><b></b><b></b></span><span class="t anim"></span>';
+ case 'pcurl': return '<span class="pg"><b></b><b></b><b></b></span><span class="nb anim"></span><span class="pg pb anim"><b></b><b></b><b></b></span><span class="fl anim"></span>';
case 'owipe': return '<span class="pg"><b></b><b></b><b></b></span><span class="pbg anim"><span class="pg"><b></b><b></b><b></b></span></span><span class="w w1 anim"></span><span class="w w2 anim"></span>';
case 'sig4': return '<span class="s4r anim"></span><span class="s4r r2 anim"></span><span class="s4r r3 anim"></span><span class="s4d"></span>';
case 'sig5': return '<span class="s5 anim"></span><span class="s5 anim"></span><span class="s5 anim"></span>';
@@ -1775,7 +1792,7 @@ let shown=[];
// under the place label or between two states). Nothing here runs without reduced motion.
const STILL={
cover:.1,curtain:.6,kinetic:.25,carousel:.1,typewriter:.55,textclip:.7,svgpath:.7,smoke:.3,leak:.7,
- flash:.41,blurpage:.2,toggle:.7,shake:.8,circlerev:.25,owipe:.165
+ flash:.41,blurpage:.2,toggle:.7,shake:.8,circlerev:.25,owipe:.165,pcurl:.44
};
function hold(card){
const anims=card.querySelector('.pv').getAnimations({subtree:true});
diff --git a/sitemap.xml b/sitemap.xml
index ef4cb228..c6191a3d 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -54,6 +54,7 @@
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/flip-technique/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/circle-reveal/</loc><lastmod>2026-10-01</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/overlay-wipe/</loc><lastmod>2026-10-01</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/page-curl/</loc><lastmod>2026-10-01</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/hover-state/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/click-ripple/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/focus-ring/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>