@moxijs/core - v0.3.4
    Preparing search index...

    Interface LoadingAnimation

    Interface for custom loading animations. Implement this to create your own loading animation plugin.

    class SpinnerAnimation implements LoadingAnimation {
    private spinner: Graphics;
    private rotation = 0;

    init(container: Container) {
    this.spinner = new Graphics();
    this.spinner.arc(0, 0, 30, 0, Math.PI * 1.5);
    this.spinner.stroke({ width: 4, color: 0xffffff });
    container.addChild(this.spinner);
    }

    update(context: LoadingAnimationContext) {
    this.rotation += context.deltaTime * 5;
    this.spinner.rotation = this.rotation;
    this.spinner.x = context.width / 2;
    this.spinner.y = context.height / 2 - 20;
    }

    reset() { this.rotation = 0; }
    destroy() { this.spinner?.destroy(); }
    }
    interface LoadingAnimation {
        destroy(): void;
        init(container: Container): void;
        reset(): void;
        update(context: LoadingAnimationContext): void;
    }

    Implemented by

    Index

    Methods

    • Initialize the animation. Add your display objects to the container.

      Parameters

      • container: Container

        Parent container to add animation elements to

      Returns void