RAGS - v1.10.0
    Preparing search index...

    Variable onFrame

    onFrame: (widget: Widget, callback: () => boolean) => CancelHandle

    Type Declaration

      • (widget: Widget, callback: () => boolean): CancelHandle
      • Calls a callback on every frame tick, synchronised to the widget's GDK frame clock.

        The callback should return true to continue receiving frame updates, or false to stop. The animation is automatically cancelled when the widget is destroyed.

        Parameters

        • widget: Widget

          The widget whose frame clock should drive the animation

        • callback: () => boolean

          Called on each frame. Return false to stop.

        Returns CancelHandle

        A CancelHandle to cancel the animation externally

        const handle = onFrame(myWidget, () => {
        opacity -= 0.02;
        myWidget.opacity = opacity;
        return opacity > 0;
        });