# Abstract Class: TickerBase<TArgs> (/jsdoc/pixi-vn/index/classes/TickerBase)



Defined in: [src/canvas/tickers/classes/TickerBase.ts:44](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L44)

A class is used to create a ticker element to add into a Pixi Application.
You can use [()](/jsdoc/pixi-vn/index/interfaces/CanvasManagerInterface#addticker) to add this element into the application.
This class should be extended and the fn method should be overridden.
You must use the [tickerDecorator](/jsdoc/pixi-vn/index/functions/tickerDecorator) to register the ticker in the game.
In Ren'Py is a transform.

Example [#example]

```typescript
\@tickerDecorator() // this is equivalent to tickerDecorator("RotateTicker")
export class RotateTicker extends TickerBase<{ speed?: number }> {
    override fn(
        t: TickerValue, // the ticker that is calling this method
        args: { // the arguments that you passed when you added the ticker
            speed?: number,
        },
        aliases: string[], // the aliases of the canvas elements that are connected to this ticker
        tickerId: string, // the id of the ticker. You can use this to get the ticker from the canvas.currentTickers
    ): void {
        let speed = args.speed === undefined ? 0.1 : args.speed
        aliases.forEach((alias) => {
                let element = canvas.find(alias)
                if (element && element instanceof Container) {
                    if (clockwise)
                        element.rotation += speed * t.deltaTime
                    else
                        element.rotation -= speed * t.deltaTime
                }
            })
    }
}
```

Type Parameters [#type-parameters]

TArgs [#targs]

`TArgs` *extends* [`TickerArgs`](/jsdoc/pixi-vn/index/interfaces/TickerArgs)

The type of the arguments that you want to pass to the ticker.

Implements [#implements]

* [`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker)\<`TArgs`>

Constructors [#constructors]

Constructor [#constructor]

\> **new TickerBase**\<`TArgs`>(`args`, `options?`): `TickerBase`\<`TArgs`>

Defined in: [src/canvas/tickers/classes/TickerBase.ts:49](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L49)

Parameters [#parameters]

args [#args]

`TArgs`

The arguments that you want to pass to the ticker.

options? [#options]

The options of the ticker.

canvasElementAliases? [#canvaselementaliases]

`string`\[]

The aliases of the canvas elements that are connected to this ticker. This is used by the system to know which canvas elements are connected to this ticker, and to pass them to the fn method.

**Default**

```ts
[]
```

duration? [#duration]

`number`

The duration of the ticker in seconds. If is undefined, the step will end only when the animation is finished (if the animation doesn't have a goal to reach then it won't finish).

**Default**

```ts
undefined
```

id? [#id]

`string`

The id of the ticker. This param is used by the system when will ber restoring the tickers from a save. If not provided, a random id will be generated.

**Default**

```ts
undefined
```

priority? [#priority]

`UPDATE_PRIORITY`

The priority of the ticker.

**Default**

```ts
UPDATE_PRIORITY.NORMAL
```

Returns [#returns]

`TickerBase`\<`TArgs`>

Properties [#properties]

alias [#alias]

\> `readonly` **alias**: `string`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:83](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L83)

Get the alias of the ticker class. This variable is used in the system to get the ticker class by id, [RegisteredTickers.getInstance](/jsdoc/pixi-vn/index/namespaces/RegisteredTickers/functions/getInstance)

Implementation of [#implementation-of]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`alias`](/jsdoc/pixi-vn/index/interfaces/Ticker#alias)

***

args [#args-1]

\> **args**: `TArgs`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:85](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L85)

Arguments to pass to the ticker

Implementation of [#implementation-of-1]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`args`](/jsdoc/pixi-vn/index/interfaces/Ticker#args)

***

canvasElementAliases [#canvaselementaliases-1]

\> **canvasElementAliases**: `string`\[] = `[]`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:89](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L89)

The aliases of the canvas elements that are connected to this ticker

Implementation of [#implementation-of-2]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`canvasElementAliases`](/jsdoc/pixi-vn/index/interfaces/Ticker#canvaselementaliases)

***

duration? [#duration-1]

\> `optional` &#x2A;*duration?**: `number`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:86](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L86)

Duration in seconds to run the ticker

Implementation of [#implementation-of-3]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`duration`](/jsdoc/pixi-vn/index/interfaces/Ticker#duration)

***

fnValue? [#fnvalue]

\> `protected` `optional` &#x2A;*fnValue?**: () => `void`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:115](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L115)

Returns [#returns-1]

`void`

***

id [#id-1]

\> `readonly` **id**: `string`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:84](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L84)

The id of the ticker. Must be unique for each ticker instance.

Implementation of [#implementation-of-4]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`id`](/jsdoc/pixi-vn/index/interfaces/Ticker#id)

***

priority? [#priority-1]

\> `optional` &#x2A;*priority?**: `UPDATE_PRIORITY`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:87](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L87)

Priority of the ticker

Implementation of [#implementation-of-5]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`priority`](/jsdoc/pixi-vn/index/interfaces/Ticker#priority)

***

ticker [#ticker]

\> `protected` **ticker**: [`TickerValue`](/jsdoc/pixi-vn/index/interfaces/TickerValue)

Defined in: [src/canvas/tickers/classes/TickerBase.ts:88](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L88)

Accessors [#accessors]

paused [#paused]

Get Signature [#get-signature]

\> **get** **paused**(): `boolean`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:140](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L140)

Checks if the ticker is paused.

Returns [#returns-2]

`boolean`

true if the ticker is paused, false otherwise.

Checks if the ticker is paused.

Implementation of [#implementation-of-6]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`paused`](/jsdoc/pixi-vn/index/interfaces/Ticker#paused)

Methods [#methods]

complete() [#complete]

\> **complete**(`_options?`): `void`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:116](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L116)

Completes the animation and applies the final state.

Parameters [#parameters-1]

\_options? [#_options]

ignoreTickerSteps? [#ignoretickersteps]

`boolean`

Returns [#returns-3]

`void`

Implementation of [#implementation-of-7]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`complete`](/jsdoc/pixi-vn/index/interfaces/Ticker#complete)

***

fn() [#fn]

\> `abstract` **fn**(`_ticker`, `_args`, `_alias`, `_tickerId`): `void`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:109](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L109)

The method that will be called every frame.
This method should be overridden and you can use [()](/jsdoc/pixi-vn/index/interfaces/CanvasManagerInterface#add) to get the canvas element of the canvas, and edit them.

Parameters [#parameters-2]

\_ticker [#_ticker]

[`TickerValue`](/jsdoc/pixi-vn/index/interfaces/TickerValue)

The ticker that is calling this method

\_args [#_args]

`TArgs`

The arguments that you passed when you added the ticker

\_alias [#_alias]

`string` | `string`\[]

The alias of the canvas elements that are connected to this ticker

\_tickerId [#_tickerid]

`string`

The id of the ticker. You can use this to get the ticker from the [canvas.currentTickers](/jsdoc/pixi-vn/index/interfaces/CanvasManagerInterface#currenttickers)

Returns [#returns-4]

`void`

***

pause() [#pause]

\> **pause**(): `void`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:134](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L134)

Pauses the animation.

Returns [#returns-5]

`void`

Implementation of [#implementation-of-8]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`pause`](/jsdoc/pixi-vn/index/interfaces/Ticker#pause)

***

play() [#play]

\> **play**(): `void`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:137](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L137)

Plays the animation.

Returns [#returns-6]

`void`

Implementation of [#implementation-of-9]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`play`](/jsdoc/pixi-vn/index/interfaces/Ticker#play)

***

start() [#start]

\> **start**(): `void`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:127](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L127)

Starts the ticker. This will start the ticker and begin the animation.

Returns [#returns-7]

`void`

Implementation of [#implementation-of-10]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`start`](/jsdoc/pixi-vn/index/interfaces/Ticker#start)

***

stop() [#stop]

\> **stop**(): `void`

Defined in: [src/canvas/tickers/classes/TickerBase.ts:119](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/tickers/classes/TickerBase.ts#L119)

Stops the animation at its current state, and prevents it from resuming when the animation is played again.

Returns [#returns-8]

`void`

Implementation of [#implementation-of-11]

[`Ticker`](/jsdoc/pixi-vn/index/interfaces/Ticker).[`stop`](/jsdoc/pixi-vn/index/interfaces/Ticker#stop)
