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.

Merge branch 'feat/see-inside-compare' into sic/02a

matinbd1cc0b0e7e0
diff --cc animations/02-entrance-and-exit/fade-in-out/index.html
index a7f1f461,1035dd08..b874e259
--- a/animations/02-entrance-and-exit/fade-in-out/index.html
+++ b/animations/02-entrance-and-exit/fade-in-out/index.html
@@@ -30,53 -30,10 +30,53 @@@
.card-icon{font-size:32px;margin-bottom:14px;opacity:.6}
.card-title{font-size:clamp(17px,2.5vw,22px);font-weight:bold;margin-bottom:8px}
.card-sub{font-size:11px;color:var(--ui-muted);line-height:1.65}
+ /* See inside and Compare. Their labels are plain words on a dark backing. */
+ .twin,.graph,.side,.when{display:none}
+ .lbl{position:absolute;padding:3px 7px;border-radius:5px;background:rgba(11,11,13,.88);color:#f4f4f2;font:600 13px/1.2 var(--hb-font);white-space:nowrap}
+ /* See inside: the card beside a graph of how solid it is over time (below it on phones, filling the room under the card). The
+ line rises with the fade in, in the shape of the Feel, stays at the top while the card stays, and with Loop on falls with the
+ fade out; the dot rides it as the card plays: across with the time, up with how solid the card is (the script draws it). */
+ .stage[data-hb-mode="inside"]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);grid-template-rows:minmax(0,1fr);
+ align-items:center;gap:clamp(12px,3vw,32px);padding:clamp(12px,3vw,32px)}
+ .stage[data-hb-mode="inside"] .card{justify-self:center}
+ .stage[data-hb-mode="inside"] .graph{display:block}
+ .graph{position:relative;width:100%;max-width:460px;aspect-ratio:300/170;max-height:100%;justify-self:center}
+ .graph svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
+ .graph .axis{fill:none;stroke:rgba(244,244,242,.5);stroke-width:1.5}
+ .graph .curve{fill:none;stroke:var(--ui-accent);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
+ .graph .dot{fill:#f4f4f2}
+ /* Compare: the card twice, each the size it has in Normal, one on each side of a thin line. On the left a copy that appears at
+ once (no fade); on the right the card itself, which fades. Between plays the right card is held a fifth of a second into its
+ fade, with those words under it (their row is kept while they are hidden, so the cards do not move when they show). */
+ .stage[data-hb-mode="compare"]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:1fr auto 1fr;
+ align-items:center;justify-items:center;gap:0 clamp(12px,3vw,32px);padding:48px clamp(8px,2vw,24px) 40px}
+ .stage[data-hb-mode="compare"]::after{content:'';position:absolute;top:0;bottom:0;left:50%;border-left:1px solid rgba(244,244,242,.12)}
+ .stage[data-hb-mode="compare"] .twin,.stage[data-hb-mode="compare"] .side,.stage[data-hb-mode="compare"] .when{display:block}
+ .stage[data-hb-mode="compare"] .card{grid-row:2}
+ .card.twin{transition:none!important}
+ .side{top:12px}
+ .side.first{left:12px}
+ .side.second{left:calc(50% + 12px)}
+ .when{position:static;grid-area:3/2;align-self:start;margin-top:10px;max-width:100%;white-space:normal;text-align:center;text-wrap:balance;
+ visibility:hidden}
+ .stage[data-hb-mode="compare"].posed .when{visibility:visible}
+ .stage[data-hb-mode="compare"].posed .card:not(.twin){opacity:var(--posed,.5)!important;transition:none!important}
+ @media(max-width:600px){
+ .stage[data-hb-mode="inside"]{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:8px}
+ .stage[data-hb-mode="inside"] .graph{max-width:none;height:100%;aspect-ratio:auto}
+ }
+ /* Phones and short boxes (a window up to 640px tall, which gives a box of 310px or less; a full card and Compare's words need
+ 306px): compact cards. Phones, held either way: four words at most in the graph. */
+ @media(max-width:600px),(max-height:640px){
+ .stage[data-hb-mode="inside"] .card,.stage[data-hb-mode="compare"] .card{padding:14px 16px}
+ .stage[data-hb-mode="inside"] .card-sub,.stage[data-hb-mode="compare"] .card-sub{display:none}
+ .stage[data-hb-mode="inside"] .card-icon,.stage[data-hb-mode="compare"] .card-icon{font-size:22px;margin-bottom:6px}
+ }
+ @media(max-width:600px),(max-height:500px){.graph:has(.xout:not([hidden])) .xstay{display:none}}
@media(prefers-reduced-motion:reduce){.card{transition:opacity 300ms linear!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=9">
- <script src="../../../assets/js/demo-page.js?v=9" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
+ <script src="../../../assets/js/demo-page.js?v=10" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">