onLoading(action: (progress: number)=>void): KEventController
Register an event that runs every frame when assets are initially loading. Can be used to draw a custom loading screen.
param
action- The function that runs when assets are loading.
``` // progress bar onLoading((progress) => { // Background of the bar drawRect({ width: 240, height: 40, pos: center().add(-120,0), color: BLACK, anchor: `left, }); // Progress of the bar drawRect({ width: map(progress, 0, 1, 0, 220), height: 32, pos: center().add(-116, 0), color: BLUE, anchor: `left }); });
returns
The event controller.
since
v3000.0