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: Holographic Card: Compare's pointer aims at the card where its fan has moved it

matine07e76e365bf
diff --git a/animations/06-3d-advanced/holographic-card/index.html b/animations/06-3d-advanced/holographic-card/index.html
index 895c9e57..485545a4 100644
--- a/animations/06-3d-advanced/holographic-card/index.html
+++ b/animations/06-3d-advanced/holographic-card/index.html
@@ -346,7 +346,7 @@ document.addEventListener('hb:input',()=>{if(holdTimer||run){stopHold();run=null
const clamp=v=>Math.max(-.5,Math.min(.5,v));
function aim(e){
const r=stage.getBoundingClientRect();
- const x=(e.clientX-r.left-stage.clientLeft-card.offsetLeft-card.offsetWidth/2)/(card.offsetWidth*cs),y=(e.clientY-r.top-stage.clientTop-card.offsetTop-card.offsetHeight/2)/(card.offsetHeight*cs);
+ const x=(e.clientX-r.left-stage.clientLeft-card.offsetLeft-card.offsetWidth/2-(parseFloat(card.style.translate)||0))/(card.offsetWidth*cs),y=(e.clientY-r.top-stage.clientTop-card.offsetTop-card.offsetHeight/2)/(card.offsetHeight*cs);
// In Compare a finger that is not on the real card's half leaves the card alone (the plain card is not aimed)
const slid=e.pointerType!=='mouse'&&e.buttons>0&&!(mode==='compare'&&e.clientX<r.left+r.width/2);
const on=Math.abs(x)<=.5&&Math.abs(y)<=.5||slid;