Scenario generator for vore roleplay and story ideas. https://scenario-generator.deliciousreya.net/responses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
821 B

function onPulseEnd(e: AnimationEvent): void {
if (e.animationName === "pulse-bg" && e.target instanceof HTMLElement) {
e.target.classList.remove("pulse")
e.target.removeEventListener("animationend", onPulseEnd)
e.target.removeEventListener("animationcancel", onPulseEnd)
}
}
export function pulseElement(element: HTMLElement) {
element.removeEventListener("animationend", onPulseEnd)
element.removeEventListener("animationcancel", onPulseEnd)
if (element.classList.contains("pulse")) {
const anim =
element.getAnimations().find(v => v instanceof CSSAnimation && v.animationName === "pulse-bg")
if (anim) {
anim.finish()
anim.play()
}
} else {
element.classList.add("pulse")
}
element.addEventListener("animationend", onPulseEnd)
element.addEventListener("animationcancel", onPulseEnd)
}