Skip to content

five-on-it / apps/client/src/renderer/camera / SpeedZoom

Class: SpeedZoom ​

Defined in: apps/client/src/renderer/camera.ts:133

The zoom out at speed: follows the car's speed through an asymmetric exponential filter (quicker up than down) and turns it into how much higher than at standstill the camera should sit. Off, it follows a speed of nothing, so turning it off mid-drive eases the view back in and turning it on eases it out, never a step.

Constructors ​

Constructor ​

new SpeedZoom(): SpeedZoom

Returns ​

SpeedZoom

Properties ​

speed ​

speed: number = 0

Defined in: apps/client/src/renderer/camera.ts:135

The speed the zoom follows (m/s): the car's, filtered; toward 0 while the zoom is off.

Methods ​

update() ​

update(speed, dt, options): number

Defined in: apps/client/src/renderer/camera.ts:141

Follows speed (m/s, either way) for dt seconds and returns the zoom: how much higher than at standstill the camera should sit, a share of the standstill height.

Parameters ​

speed ​

number

dt ​

number

options ​

SpeedZoomOptions

Returns ​

number


zoom() ​

zoom(strength): number

Defined in: apps/client/src/renderer/camera.ts:150

The zoom at the filtered speed now, for a strength (a share of the standstill height).

Parameters ​

strength ​

number

Returns ​

number