simple-visual-novel
    Preparing search index...

    Function fadeOut

    • Fades out an element by animating its opacity from 1 to 0.

      Uses CSS transitions for smooth animation. The returned promise can be cancelled to immediately hide the element.

      Parameters

      • element: HTMLElement

        The DOM element to fade out

      • Optionaloptions: FadeOptions = {}

        Fade options

        Options for configuring fade effects.

        FadeOptions

        • Optionalduration?: number

          Animation duration in milliseconds.

        • OptionalonComplete?: () => void

          Callback function invoked when the animation completes (either naturally or when cancelled).

      Returns Promise<void>

      A cancellable promise that resolves when animation completes. Call .cancel() to immediately hide the element.

      const element = document.getElementById("character");
      const animation = fadeOut(element, { duration: 300 });

      // Optionally cancel to hide immediately
      animation.cancel();