Skip to main content

Class: Raf

优化的 raf 管理

const raf = new Raf();

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Raf(cb, options?): Raf

Parameters

NameType
cbany
optionsPartial<RafOptions>

Returns

Raf

Defined in

src/animation/Raf.ts:33

Properties

options

options: Partial<RafOptions>

Defined in

src/animation/Raf.ts:24

Accessors

visible

get visible(): boolean

获取当前页面是否可见

Returns

boolean

Defined in

src/animation/Raf.ts:56


animating

get animating(): boolean

获取当前raf 状态

Returns

boolean

Defined in

src/animation/Raf.ts:63


elapsedTime

get elapsedTime(): number

获取总时长

Returns

number

Defined in

src/animation/Raf.ts:81

Methods

reset

reset(): void

重置当前 raf 状态

Returns

void

Defined in

src/animation/Raf.ts:70


start

start(): void

启动 raf

Returns

void

Defined in

src/animation/Raf.ts:88


stop

stop(): void

停止 raf

Returns

void

Defined in

src/animation/Raf.ts:108


tick

tick(): void

Returns

void

Defined in

src/animation/Raf.ts:120