Interface: CanvasTickersInterface
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:3
Properties
currentTickers
> readonly currentTickers: Map<string, TickerInfo<any>>
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:14
Currently tickers that are running.
currentTickersSteps
> readonly currentTickersSteps: Map<string, Map<string, TickersSequence>>
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:18
The steps of the tickers
Methods
add()
> add<TArgs>(canvasElementAlias, ticker): string | undefined
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:38
Run a ticker. You can run multiple add with the same alias and different tickerClasses. If you run a ticker with the same alias and tickerClass, the old ticker will be removed. If already exists a sequence of tickers with the same alias, it will be removed.
Type Parameters
TArgs
TArgs extends TickerArgs
Parameters
canvasElementAlias
string | string[]
The alias of the canvas element that will use the ticker.
ticker
Ticker<TArgs>
The ticker class to be run.
Returns
string | undefined
The id of the ticker that was added.
Example
canvas.tickers.add("alien", new RotateTicker({ speed: 0.2 }))addSequence()
> addSequence(alias, steps, currentStepNumber?): string | undefined
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:57
Run a sequence of tickers.
Parameters
alias
string
The alias of canvas element that will use the tickers.
steps
Ticker<any>[]
The steps of the tickers.
currentStepNumber?
number
The current step number. It is used to continue the sequence of tickers.
Returns
string | undefined
The id of tickers.
Example
canvas.tickers.addSequence("alien", [
new RotateTicker({ speed: 0.1, clockwise: true }, 2), // runs for 2 seconds
new RotateTicker({ speed: 0.2, clockwise: false }, 2),
])Deprecated
completeOnStepEnd()
> completeOnStepEnd(step): void
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:139
Add a ticker that must be completed before the next step. This method is used for example into a transition between scenes.
Parameters
step
The step that the ticker must be completed before the next step.
alias?
string
If is a sequence of tickers, the alias of the sequence of tickers.
id
string
The id of the step.
Returns
void
find()
> find<TArgs>(tickerId, args?): Ticker<TArgs> | undefined
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:25
Find a ticker by its id.
Type Parameters
TArgs
TArgs extends TickerArgs
Parameters
tickerId
string
The id of the ticker to be found.
args?
TArgs
The args of the ticker.
Returns
Ticker<TArgs> | undefined
The ticker if found, undefined otherwise.
forceCompletion()
> forceCompletion(id, alias?): Promise<void>
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:155
This method force the completion of the tickers that are running. This funcions is called in the next step.
Parameters
id
string
The id of the ticker. If the alias provided, the id is the id of the sequence of tickers.
alias?
string
The alias of the sequence of tickers.
Returns
Promise<void>
isPaused()
> isPaused(alias, tickerId?): boolean
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:133
Check if a ticker is paused.
Parameters
alias
string
The alias of the canvas element that will use the ticker.
tickerId?
string
The ticker that will be checked.
Returns
boolean
If the ticker is paused.
onComplete()
> onComplete(tickerId, options): void
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:156
Parameters
tickerId
string
options
aliasToRemoveAfter
string[]
ignoreTickerSteps?
boolean
stopTicker?
boolean
tickerAliasToResume
string[]
tickerIdToResume
string[]
Returns
void
pause()
> pause(filters): string[]
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:87
Pause a ticker. If a paused ticker have a time to be removed, it will be removed after the time.
Parameters
filters
{ canvasAlias: string; tickerIdsExcluded?: string[]; } | { id: string | string[]; }
The filters to pause the ticker.
Type Literal
{ canvasAlias: string; tickerIdsExcluded?: string[]; }
The filters to pause the ticker.
canvasAlias
string
The alias of the canvas element that will use the ticker. Will pause all tickers that are connected to this canvas element.
tickerIdsExcluded?
string[]
Ticker ids excluded from the pause. If not provided, all tickers will be paused.
Type Literal
{ id: string | string[]; }
The filters to pause the ticker.
id
string | string[]
The id of the ticker to be paused. If provided, only this ticker will be paused.
Returns
string[]
The ids of the paused tickers.
remove()
> remove(tickerId): void
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:81
Remove a ticker by the id.
Parameters
tickerId
string | string[]
The id or an array of ids of the ticker to be removed.
Returns
void
removeAll()
> removeAll(): void
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:76
Remove all tickers from the canvas.
Returns
void
resume()
> resume(filters): void
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:111
Resume a ticker.
Parameters
filters
{ canvasAlias: string; } | { id: string | string[]; }
The filters to resume the ticker.
Type Literal
{ canvasAlias: string; }
The filters to resume the ticker.
canvasAlias
string
The alias of the canvas element that will use the ticker. Will resume all tickers that are connected to this canvas element.
Type Literal
{ id: string | string[]; }
The filters to resume the ticker.
id
string | string[]
The id of the ticker to be resumed. If provided, only this ticker will be resumed.
Returns
void
transfer()
> transfer(oldAlias, newAlias, mode?): void
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:10
Transfer the tickers from an old alias to a new alias.
Parameters
oldAlias
string
Old alias
newAlias
string
New alias
mode?
"move" | "duplicate"
If "move", the old alias will be removed from the ticker. If "duplicate", the old alias will be kept in the ticker.
Returns
void
unlinkComponent()
> unlinkComponent(alias, ticker?): void
Defined in: src/canvas/interfaces/CanvasTickersInterface.ts:72
Remove a connection between a canvas element and a ticker. And remove the ticker if there is no canvas element connected to it.
Parameters
alias
string | string[]
The alias of the canvas element that will use the ticker.
ticker?
string | (() => Ticker<any>)
The ticker class to be removed.
Returns
void
Example
canvas.tickers.unlinkComponent("alien", RotateTicker)