sssema96,
а про css почитать по ссылкам выше?
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.led2 {
background-color: black;
width: 40px;
height: 16px;
}
.active {
animation: 5s big;
}
@keyframes big {
50% {
transform: scale(3);
}
}
</style>
<script>
document.addEventListener("click", ({ target }) => {
target = target.closest(".show-image");
if (target) {
let div = document.querySelector(".led2");
div.classList.remove("active");
document.documentElement.clientHeight;
div.classList.add("active")
}
})
</script>
</head>
<body>
<div class="led2"></div>
<button class="show-image" type="button" id="clickGreen">Click me</button>
</body>
</html>