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.

fix: Copy to Clipboard: See inside's flash label returns after Compare, its labels clear phone offsets when widened, and Compare's note names the live button

matin424a6a0571eb
diff --git a/animations/04-micro-interactions/copy-to-clipboard/index.html b/animations/04-micro-interactions/copy-to-clipboard/index.html
index 060dfab0..86fe6d69 100644
--- a/animations/04-micro-interactions/copy-to-clipboard/index.html
+++ b/animations/04-micro-interactions/copy-to-clipboard/index.html
@@ -82,7 +82,7 @@
.t-track{background:rgba(244,244,242,.2)}
.t-bar{background:var(--ok);transform-origin:0 50%}
.t-mark{right:auto;left:-6px;top:0;width:12px;height:12px;border-radius:50%;background:#f4f4f2}
- .stage[data-hb-mode="inside"]:has(.copy-btn.copied) .c-flash,.stage[data-hb-mode="inside"]:has(.copy-btn.copied) .l-flash{animation:flashcap 900ms linear both}
+ .stage[data-hb-mode="inside"]:has(#copyBtn.copied) .c-flash,.stage[data-hb-mode="inside"]:has(#copyBtn.copied) .l-flash{animation:flashcap 900ms linear both}
@keyframes flashcap{0%,65%{opacity:1}100%{opacity:0}}
@media(max-width:600px),(max-height:500px){.stage[data-hb-mode="inside"] .views .c-flash,.stage[data-hb-mode="inside"] .l-flash{display:none}}
.stage[data-hb-mode="compare"]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:center;justify-items:center;padding:0 8px}
@@ -176,7 +176,7 @@
</div>
<div class="hb-mode-notes" aria-live="polite">
<p data-hb-for="inside" hidden>Inside, both icons and both words share one spot each, so the button never changes size; the bar shows how long the confirmation stays. Press Copy, or Show me.</p>
- <p data-hb-for="compare" hidden>No sign: the code is copied but nothing shows it; Confirms: a tick, a green flash and Copied tell you it worked. Press Copy, or Show me.</p>
+ <p data-hb-for="compare" hidden>No sign: the code is copied but nothing shows it; Confirms: a tick, a green flash and Copied tell you it worked. Press the button under Confirms, or Show me.</p>
</div>
</section>
@@ -380,7 +380,7 @@
const FEEL=['with a small bounce','slowing to a stop','at one steady speed'];
const HALVES=['','half a second','a second','a second and a half','two seconds','two and a half seconds','three seconds','three and a half seconds','four seconds'];
let mode='normal',speedAt=1,feelAt=0,copying=false,runStart=0,runTotal=0,markRaf=0,backTimer=0;
- if(!motionOk)$('[data-hb-for="compare"]').textContent='No sign: the code is copied but nothing shows it; Confirms: a tick and Copied tell you it worked. Press Copy, or Show me.';
+ if(!motionOk)$('[data-hb-for="compare"]').textContent='No sign: the code is copied but nothing shows it; Confirms: a tick and Copied tell you it worked. Press the button under Confirms, or Show me.';
// Compare's copies, made once: the first half (a button that is only a picture) and the button caught in its swap
const one=document.createElement('div'),row1=row.cloneNode(true),still=document.createElement('span');
@@ -436,7 +436,7 @@
L=over(cap.icons,Io.x);seg('icons',mid(Io.x,L.l+4,L.r-4),L.b,mid(Io.x,L.l+4,L.r-4),Io.t);
L=over(cap.words,Wo.x);seg('words',mid(Wo.x,L.l+4,L.r-4),L.t,mid(Wo.x,L.l+4,L.r-4),Wo.b);
}else{
- L=R(cap.icons);seg('icons',L.r,L.y,Io.l,Io.y);
+ cap.icons.style.translate=cap.words.style.translate='';L=R(cap.icons);seg('icons',L.r,L.y,Io.l,Io.y);
L=R(cap.words);seg('words',L.l,L.y,Wo.r,Wo.y);
L=R(cap.flash);seg('flash',L.l,L.b,B.r-26,B.t+22);
}