From 94df5140f865831619967dc3fc30a722b8c58ba8 Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Fri, 6 Feb 2026 14:28:47 -0800 Subject: [PATCH] Add cannon recoil animation --- html/images/space.svg | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/html/images/space.svg b/html/images/space.svg index b9ee868..596d86d 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -100,6 +100,15 @@ opacity: 0.2; r: 5px; } + + #cannon .tip { + transform: translate(-2px); + } + + #cannon .tip.recoil { + transform: translate(0px); + transition: transform 0.25s ease-out; + } @@ -110,7 +119,8 @@ - + + @@ -1356,6 +1366,9 @@ function drawShot(shot) { lineEl.setAttribute('y2', shot.target.y); lineEl.addEventListener('transitionend', e => e.target.remove()); setTimeout(() => lineEl.classList.add('fade'), 1000); + const tipEl = document.querySelector("#cannon .tip") + tipEl.classList.remove("recoil"); + setTimeout(() => tipEl.classList.add('recoil'), 0); let pt, hit; for (let i = 0; i <= lineEl.getTotalLength(); i++) {