any cool js animations for on click effect kindly suggest,
Loading
any cool js animations for on click effect kindly suggest,
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mohamed Azarudeen ZPosted May 18, 2023, 7:41 AM
Hi vamsi try this
If u can give more details on what you are expecting ill try a few more
Deepak RawatPosted May 18, 2023, 12:37 PM
JavaScript animation for an on-click effect using the GSAP (GreenSock Animation Platform) library
Vishal JoshiPosted May 18, 2023, 11:51 AM
Hello Vamsi,
Please check out the below sample code for js animation.
Please share more detail like the case where needed animation so accordingly we can review and use third-party animation or create our own custom animation.
Thanks
Prathap ReddyPosted May 18, 2023, 8:04 AM
Hi Vamsi !
You can go through the below code snippet :
const btn = document.querySelector("button");
btn.addEventListener("click", () => {
const ripple = document.createElement("div");
ripple.classList.add("ripple");
ripple.style.top = btn.offsetTop + "px";
ripple.style.left = btn.offsetLeft + "px";
document.body.appendChild(ripple);
ripple.addEventListener("animationend", () => {
document.body.removeChild(ripple);
});
ripple.animate({
width: btn.offsetWidth,
height: btn.offsetHeight,
borderRadius: "50%",
background: "red",
}, {
duration: 500,
});
});