Skip to content
On this page

Class: Ticker

刷新器

Hierarchy

  • EventEmitter

    Ticker

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Ticker()

Inherited from

EE.constructor

Properties

_stepTime

_stepTime: number

Defined in

src/core/ticker/Ticker.ts:27


animationFrame

animationFrame: number

Defined in

src/core/ticker/Ticker.ts:38


deltaTime

deltaTime: number = 1

上一帧和当前帧间隔时间 ms

Defined in

src/core/ticker/Ticker.ts:51


fillTime

fillTime: number = 0

需要填补的时间

Defined in

src/core/ticker/Ticker.ts:60


lastFrameTime

lastFrameTime: number = 0

上一次屏幕刷新的时间

Defined in

src/core/ticker/Ticker.ts:55


lastTime

lastTime: number = 0

记录上一帧的时间

Defined in

src/core/ticker/Ticker.ts:25


paused

paused: boolean = false

Defined in

src/core/ticker/Ticker.ts:92


prefixed

Static prefixed: string | boolean

Inherited from

EE.prefixed

Defined in

node_modules/eventemitter3/index.d.ts:9

Accessors

FPS

get FPS(): number

每秒帧数
最大帧数不会超过浏览器刷新率
默认每秒60帧

Returns

number

Defined in

src/core/ticker/Ticker.ts:14

set FPS(val): void

Parameters

NameType
valnumber

Returns

void

Defined in

src/core/ticker/Ticker.ts:17

Methods

addListener

addListener<T>(event, fn, context?): Ticker

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn(...args: any[]) => void
context?any

Returns

Ticker

Inherited from

EE.addListener

Defined in

node_modules/eventemitter3/index.d.ts:45


destroy

destroy(): void

销毁

Returns

void

Defined in

src/core/ticker/Ticker.ts:105


emit

emit<T>(event, ...args): boolean

Calls each of the listeners registered for a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
...argsany[]

Returns

boolean

Inherited from

EE.emit

Defined in

node_modules/eventemitter3/index.d.ts:32


eventNames

eventNames(): (string | symbol)[]

Return an array listing the events for which the emitter has registered
listeners.

Returns

(string | symbol)[]

Inherited from

EE.eventNames

Defined in

node_modules/eventemitter3/index.d.ts:15


listenerCount

listenerCount(event): number

Return the number of listeners listening to a given event.

Parameters

NameType
eventstring | symbol

Returns

number

Inherited from

EE.listenerCount

Defined in

node_modules/eventemitter3/index.d.ts:27


listeners

listeners<T>(event): (...args: any[]) => void[]

Return the listeners registered for a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT

Returns

(...args: any[]) => void[]

Inherited from

EE.listeners

Defined in

node_modules/eventemitter3/index.d.ts:20


off

off<T>(event, fn?, context?, once?): Ticker

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn?(...args: any[]) => void
context?any
once?boolean

Returns

Ticker

Inherited from

EE.off

Defined in

node_modules/eventemitter3/index.d.ts:69


on

on<T>(event, fn, context?): Ticker

Add a listener for a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn(...args: any[]) => void
context?any

Returns

Ticker

Inherited from

EE.on

Defined in

node_modules/eventemitter3/index.d.ts:40


once

once<T>(event, fn, context?): Ticker

Add a one-time listener for a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn(...args: any[]) => void
context?any

Returns

Ticker

Inherited from

EE.once

Defined in

node_modules/eventemitter3/index.d.ts:54


removeAllListeners

removeAllListeners(event?): Ticker

Remove all listeners, or those of the specified event.

Parameters

NameType
event?string | symbol

Returns

Ticker

Inherited from

EE.removeAllListeners

Defined in

node_modules/eventemitter3/index.d.ts:79


removeListener

removeListener<T>(event, fn?, context?, once?): Ticker

Remove the listeners of a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn?(...args: any[]) => void
context?any
once?boolean

Returns

Ticker

Inherited from

EE.removeListener

Defined in

node_modules/eventemitter3/index.d.ts:63


start

start(): void

开始

Returns

void

Defined in

src/core/ticker/Ticker.ts:32


stop

stop(): void

暂停

Returns

void

Defined in

src/core/ticker/Ticker.ts:97


update

update(time): void

每次刷新要执行的内容

Parameters

NameType
timenumber

Returns

void

Defined in

src/core/ticker/Ticker.ts:65