79824342

Date: 2025-11-19 10:52:28
Score: 2
Natty:
Report link

Is this the animation that you're looking for?

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Animation Test</title>
</head>

<body>
    <h1>Animation Test</h1>
    <div id="thing"></div>
</body>

</html>
div#thing {
    position: absolute;
    background-color: cyan;
    outline: 1px solid black;
    left : 25%;
    top : 25%;
    width : 50%;
    height : 50%;
    animation-name: none;
    animation-duration: 2s;
  --currentScale : 1;
}

div#thing:active {
    transition: transform 2s;
    transition-delay : 1s;
    --currentScale: 1.2;
    transform: scale(1.2);
}

@keyframes scale-down
{
    0% { transform: scale(var(--currentScale)); }
    100% { transform: scale(0); }
}
const thing = document.getElementById("thing");

thing.addEventListener("animationend", () => { 
  thing.style.setProperty("animation-name", "none"); 
});

thing.addEventListener("click", () => {
  thing.style.setProperty("--currentScale", "1.2");
  thing.style.setProperty("animation-name", "scale-down");
});
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): Is this the
  • Low reputation (1):
Posted by: Tbjamie