Skip to main content

Class: AnimationLoop

Defined in: modules/engine/src/animation-loop/animation-loop.ts:65

Convenient animation loop

Constructors​

Constructor​

new AnimationLoop(props): AnimationLoop

Defined in: modules/engine/src/animation-loop/animation-loop.ts:114

Parameters​

props​

AnimationLoopProps

Returns​

AnimationLoop

Properties​

_animationFrameId​

_animationFrameId: any = null

Defined in: modules/engine/src/animation-loop/animation-loop.ts:104


_cpuStartTime​

_cpuStartTime: number = 0

Defined in: modules/engine/src/animation-loop/animation-loop.ts:107


_error​

_error: Error | null = null

Defined in: modules/engine/src/animation-loop/animation-loop.ts:108


_initialized​

_initialized: boolean = false

Defined in: modules/engine/src/animation-loop/animation-loop.ts:102


_lastFrameTime​

_lastFrameTime: number = 0

Defined in: modules/engine/src/animation-loop/animation-loop.ts:109


_nextFramePromise​

_nextFramePromise: Promise<AnimationLoop> | null = null

Defined in: modules/engine/src/animation-loop/animation-loop.ts:105


_resolveNextFrame​

_resolveNextFrame: ((animationLoop) => void) | null = null

Defined in: modules/engine/src/animation-loop/animation-loop.ts:106


_running​

_running: boolean = false

Defined in: modules/engine/src/animation-loop/animation-loop.ts:103


animationProps​

animationProps: AnimationProps | null = null

Defined in: modules/engine/src/animation-loop/animation-loop.ts:90


canvas​

canvas: OffscreenCanvas | HTMLCanvasElement | null = null

Defined in: modules/engine/src/animation-loop/animation-loop.ts:87


cpuTime​

cpuTime: Stat

Defined in: modules/engine/src/animation-loop/animation-loop.ts:94


device​

device: Device | null = null

Defined in: modules/engine/src/animation-loop/animation-loop.ts:86


display​

display: any

Defined in: modules/engine/src/animation-loop/animation-loop.ts:98


frameRate​

frameRate: Stat

Defined in: modules/engine/src/animation-loop/animation-loop.ts:96


gpuTime​

gpuTime: Stat

Defined in: modules/engine/src/animation-loop/animation-loop.ts:95


props​

props: ResolvedAnimationLoopProps

Defined in: modules/engine/src/animation-loop/animation-loop.ts:89


sharedStats​

sharedStats: Stats

Defined in: modules/engine/src/animation-loop/animation-loop.ts:93


stats​

stats: Stats

Defined in: modules/engine/src/animation-loop/animation-loop.ts:92


timeline​

timeline: Timeline | null = null

Defined in: modules/engine/src/animation-loop/animation-loop.ts:91


defaultAnimationLoopProps​

static defaultAnimationLoopProps: object

Defined in: modules/engine/src/animation-loop/animation-loop.ts:66

animationFrameProvider​

readonly animationFrameProvider: AnimationFrameProvider = defaultAnimationFrameProvider

autoResizeViewport​

readonly autoResizeViewport: false = false

device​

readonly device: never

mobileQuality​

readonly mobileQuality: undefined = undefined

onAddHTML​

readonly onAddHTML: () => string

Returns​

string

onError​

readonly onError: (error) => void

Parameters​
error​

Error

Returns​

void

onFinalize​

readonly onFinalize: () => void

Returns​

void

onInitialize​

readonly onInitialize: () => Promise<null>

Returns​

Promise<null>

onRender​

readonly onRender: () => void

Returns​

void

stats​

readonly stats: never

Methods​

_animationFrame()​

_animationFrame(time, animationFrame?): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:373

Parameters​

time​

number

animationFrame?​

unknown

Returns​

void


_beginFrameTimers()​

_beginFrameTimers(time?): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:561

Parameters​

time?​

number

Returns​

void


_cancelAnimationFrame()​

_cancelAnimationFrame(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:364

Returns​

void


_clearNeedsRedraw()​

_clearNeedsRedraw(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:406

Returns​

void


_consumeEncodedGpuTime()​

_consumeEncodedGpuTime(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:587

Returns​

void


_createInfoDiv()​

_createInfoDiv(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:510

Returns​

void


_endFrameTimers()​

_endFrameTimers(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:578

Returns​

void


_getAnimationProps()​

_getAnimationProps(): AnimationProps

Defined in: modules/engine/src/animation-loop/animation-loop.ts:456

Returns​

AnimationProps


_getSizeAndAspect()​

_getSizeAndAspect(): object

Defined in: modules/engine/src/animation-loop/animation-loop.ts:532

Returns​

object

aspect​

aspect: number

height​

height: number

width​

width: number


_initDevice()​

_initDevice(): Promise<void>

Defined in: modules/engine/src/animation-loop/animation-loop.ts:501

Wait for supplied device

Returns​

Promise<void>


_initialize()​

_initialize(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:327

Returns​

void


_initializeAnimationProps()​

_initializeAnimationProps(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:415

Returns​

void


_onMouseleave()​

_onMouseleave(event): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:648

Parameters​

event​

Event

Returns​

void


_onMousemove()​

_onMousemove(event): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:642

Parameters​

event​

Event

Returns​

void


_renderFrame()​

_renderFrame(animationProps): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:389

Parameters​

animationProps​

AnimationProps

Returns​

void


_requestAnimationFrame()​

_requestAnimationFrame(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:354

Returns​

void


_resizeViewport()​

_resizeViewport(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:545

Returns​

void

Deprecated​

Default viewport setup


_setDisplay()​

_setDisplay(display): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:340

Parameters​

display​

any

Returns​

void


_setupFrame()​

_setupFrame(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:410

Returns​

void


_startEventHandling()​

_startEventHandling(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:629

Returns​

void


_stopEventHandling()​

_stopEventHandling(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:636

Returns​

void


_updateAnimationProps()​

_updateAnimationProps(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:464

Returns​

void


_updateSharedStats()​

_updateSharedStats(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:599

Returns​

void


attachTimeline()​

attachTimeline(timeline): Timeline

Defined in: modules/engine/src/animation-loop/animation-loop.ts:293

Add a timeline, it will be automatically updated by the animation loop.

Parameters​

timeline​

Timeline

Returns​

Timeline


delete()​

delete(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:151

Returns​

void

Deprecated​

Use .destroy()


destroy()​

destroy(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:143

Returns​

void


detachTimeline()​

detachTimeline(): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:299

Remove a timeline

Returns​

void


needsRedraw()​

needsRedraw(): string | false

Defined in: modules/engine/src/animation-loop/animation-loop.ts:174

Query redraw status. Clears the flag.

Returns​

string | false


redraw()​

redraw(time?, animationFrame?): this

Defined in: modules/engine/src/animation-loop/animation-loop.ts:263

Explicitly draw a frame

Parameters​

time?​

number

animationFrame?​

unknown = null

Returns​

this


reportError()​

reportError(error): void

Defined in: modules/engine/src/animation-loop/animation-loop.ts:155

Parameters​

error​

Error

Returns​

void


setNeedsRedraw()​

setNeedsRedraw(reason): this

Defined in: modules/engine/src/animation-loop/animation-loop.ts:168

Flags this animation loop as needing redraw

Parameters​

reason​

string

Returns​

this


setProps()​

setProps(props): this

Defined in: modules/engine/src/animation-loop/animation-loop.ts:180

Parameters​

props​

MutableAnimationLoopProps

Returns​

this


start()​

start(): Promise<AnimationLoop | null>

Defined in: modules/engine/src/animation-loop/animation-loop.ts:201

Starts a render loop if not already running

Returns​

Promise<AnimationLoop | null>


stop()​

stop(): AnimationLoop

Defined in: modules/engine/src/animation-loop/animation-loop.ts:244

Stops a render loop if already running, finalizing

Returns​

AnimationLoop


toDataURL()​

toDataURL(): Promise<string>

Defined in: modules/engine/src/animation-loop/animation-loop.ts:316

TODO - should use device.deviceContext

Returns​

Promise<string>


waitForRender()​

waitForRender(): Promise<AnimationLoop>

Defined in: modules/engine/src/animation-loop/animation-loop.ts:304

Wait until a render completes

Returns​

Promise<AnimationLoop>