# Class: Animation
core.Animation
Class for an animation that happens on a ResponsiveCanvas
.
Time evolution of animations may be controlled using the Controller
.
# Table of contents
# Properties
# Constructors
# Methods
# Properties
# Defaults
▪ Static
Defaults: Object
Name | Default value |
---|---|
period | 1000 |
repeat | true |
# Type declaration
Name | Type |
---|---|
period | number |
repeat | boolean |
# Defined in
core/Animation.ts:38 (opens new window)
# parent
• parent: PulsarObject
The parent PulsarObject
instance.
# Defined in
core/Animation.ts:18 (opens new window)
# func
• func: (time
: number
) => void
# Type declaration
▸ (time
): void
Function which generates a frame of the animation given a timestamp.
# Parameters
Name | Type |
---|---|
time | number |
# Returns
void
# Defined in
core/Animation.ts:22 (opens new window)
# period
• period: number
= Animation.Defaults.period
Period of the animation in milliseconds
# Defined in
core/Animation.ts:26 (opens new window)
# repeat
• repeat: boolean
= Animation.Defaults.repeat
Indicates whether the animation repeats or not.
# Defined in
core/Animation.ts:30 (opens new window)
# Constructors
# constructor
• new Animation(parent
, func
, options?
)
# Parameters
Name | Type | Description |
---|---|---|
parent | PulsarObject | Parent PulsarObject instance. |
func | (time : number ) => void | The animation function. |
options | Partial <{ period : number ; repeat : boolean }> | Options for the animation. |
# Defined in
core/Animation.ts:48 (opens new window)
# Methods
# animate
▸ animate(time
): void
Calls func with the current timestamp if the animation should be running.
Called as part of the event loop if animationsActive
is set.
# Parameters
Name | Type | Description |
---|---|---|
time | number | The current timestamp of the app. |
# Returns
void
# Defined in
core/Animation.ts:67 (opens new window)
# setPeriod
▸ setPeriod(period
): void
Sets the period.
# Parameters
Name | Type | Description |
---|---|---|
period | number | Period in milliseconds. |
# Returns
void
# Defined in
core/Animation.ts:78 (opens new window)
# setRepeat
▸ setRepeat(repeat
): void
Sets the repeat flag.
# Parameters
Name | Type | Description |
---|---|---|
repeat | boolean | Repeat flag. |
# Returns
void