Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
FrameTaskHandle | Registers a frame task. more details | scheduling | |
Object | Schedules the execution of a | scheduling |
Method Details
-
-
Registers a frame task. An animation frame is composed of different phases to let various actors execute code before, after, or during the rendering of MapView or SceneView.
Parameterphases PhaseCallbacksThe callbacks for each phase of the frame.
ReturnsType Description FrameTaskHandle A handle to remove, pause, or resume the frame task. Example// Animate the scene view camera heading in every frame let handle = scheduling.addFrameTask({ update: function() { let camera = view.camera.clone(); camera.heading += 0.2; view.camera = camera; } }); // Remove frame task as soon as the user starts navigating in the view reactiveUtils.whenOnce(() => view.navigating, () => handle.remove());
-
-
Schedules the execution of a
callback
function at the next web browser tick. Unlike addFrameTask, a scheduledcallback
will only run once. Scheduling a task for the next execution tick can be useful when you want to throttle/accumulate functionality over a single javascript execution context.Parametercallback FunctionThe function to call at the next tick.
ReturnsType Description Object Returns an scheduling handler with a remove()
method that can be called to prevent the callback to be called at the next tick.Property Type Description remove Function When called, removes the callback from the callbacks queue. Example// Use scheduling.schedule to log an error message at most once per tick let logErrorHandle; function logError(error) { if (!logErrorHandle) { logErrorHandle = scheduling.schedule(function() { console.error(error); logErrorHandle = null; }); } });
Type Definitions
-
FrameTaskHandle Object
-
An object to remove or pause a frame task registered with addFrameTask().
-
PhaseCallback(event)
-
A function called at a specific phase of the animation frame.
Parameterevent PhaseEventoptionalAn object with timing information.
-
PhaseCallbacks Object
-
A set of callbacks that will be called at specific phases of the animation frame.
- Properties
-
prepare PhaseCallback
A callback called before rendering.
render PhaseCallbackA callback to execute rendering logic.
update PhaseCallbackA callback to execute state update logic.
-
PhaseEvent Object
-
An object with timing information.
- Properties
-
time Number
The absolute time at the start of the current animation frame.
deltaTime NumberThe elapsed time since the last animation frame.
elapsedFrameTime NumberThe amount of time spent within the current animation frame. This can be used for budgeting (e.g. some tasks may already have run).