From 3270e2ad44a33d2256b21b68880546354bb055fb Mon Sep 17 00:00:00 2001 From: fand Date: Thu, 4 Jul 2024 12:02:53 -0700 Subject: [PATCH] fix: recover the original opacity of the element on VFX.remove() --- packages/vfx-js/src/vfx-player.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vfx-js/src/vfx-player.ts b/packages/vfx-js/src/vfx-player.ts index 7b4f4c5..7df02c3 100644 --- a/packages/vfx-js/src/vfx-player.ts +++ b/packages/vfx-js/src/vfx-player.ts @@ -285,7 +285,10 @@ export class VFXPlayer { removeElement(element: HTMLElement): void { const i = this.#elements.findIndex((e) => e.element === element); if (i !== -1) { - this.#elements.splice(i, 1); + const e = this.#elements.splice(i, 1)[0] as VFXElement; + + // Recover the original state + element.style.setProperty("opacity", e.originalOpacity.toString()); } }