# Class: Controller

core.Controller

Singleton class which controls main event loop of Pulsar. The event loop runs using a recursive call to requestAnimationFrame (opens new window). On every pass of the loop, ResponsiveCanvas instances which are in the DOM and have their updateFlag set will be redrawn. If animationsActive is set, all Animation instances will also be updated if they are visible in the DOM.

# Table of contents

# Properties

# Constructors

# Methods

# Properties

# instance

▪ Static instance: Controller

The singleton instance.

# Defined in

core/Controller.ts:14 (opens new window)


# activeObjects

• activeObjects: PulsarObject[] = []

List of current PulsarObject instances.

# Defined in

core/Controller.ts:18 (opens new window)


# activeAnimations

• activeAnimations: Animation[] = []

List of current Animation instances.

# Defined in

core/Controller.ts:22 (opens new window)


# animationsActive

• animationsActive: boolean = false

Indicates whether Animations are currently running.

# Defined in

core/Controller.ts:26 (opens new window)


# startTimestamp

• startTimestamp: number = 0

The timestamp when the start() method was called.

# Defined in

core/Controller.ts:30 (opens new window)


# offsetTimestamp

• offsetTimestamp: number = 0

The timestamp when the pause() method was called.

# Defined in

core/Controller.ts:34 (opens new window)

# Constructors

# constructor

• new Controller()

# Defined in

core/Controller.ts:36 (opens new window)

# Methods

# start

▸ start(): void

Starts time evolution of animations.

# Returns

void

# Defined in

core/Controller.ts:48 (opens new window)


# stop

▸ stop(): void

Stops time evolution of animations and resets animation progress to t=0.

# Returns

void

# Defined in

core/Controller.ts:56 (opens new window)


# pause

▸ pause(): void

Pauses time evolution of animations.

# Returns

void

# Defined in

core/Controller.ts:68 (opens new window)


# update

▸ update(currentTimestamp): void

Updates all animations if animationsActive is set, updates all canvases that have updateFlag set. Called as part of the event loop.

# Parameters

Name Type Description
currentTimestamp number Current timestamp of the app.

# Returns

void

# Defined in

core/Controller.ts:78 (opens new window)