FlxCamera
Renderer-neutral Flixel camera state.
Pixi render targets and display objects are owned by FlxCameraRenderer; this class owns only deterministic simulation and coordinate transforms.
export declare class FlxCamera extends FlxBasicConstructors
constructor(x: number, y: number, width: number, height: number, zoom?: number)Constructs a new instance of the FlxCamera class
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
width | number | - |
height | number | - |
zoom | number | - |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
alpha | - | number | - |
angle | - | number | - |
antialiasing | - | boolean | - |
bgColor | - | number | - |
bounds | - | FlxRect | null | - |
color | - | number | - |
deadzone | - | FlxRect | null | - |
defaultZoom | static | number | - |
destroyed | readonly | boolean | - |
height | - | number | - |
scale | readonly | FlxPoint | - |
scroll | readonly | FlxPoint | - |
SHAKE_BOTH_AXES | static readonly | `` | - |
SHAKE_HORIZONTAL_ONLY | static readonly | `` | - |
SHAKE_VERTICAL_ONLY | static readonly | `` | - |
STYLE_LOCKON | static readonly | `` | - |
STYLE_PLATFORMER | static readonly | `` | - |
STYLE_TOPDOWN_TIGHT | static readonly | `` | - |
STYLE_TOPDOWN | static readonly | `` | - |
target | - | FlxObject | null | - |
width | - | number | - |
x | - | number | - |
y | - | number | - |
zoom | - | number | - |
Methods
containsScreenPoint()
containsScreenPoint(point: Readonly<PointLike>): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
point | Readonly<PointLike> | - |
Returns: boolean
copyFrom()
copyFrom(camera: FlxCamera): thisParameters:
| Parameter | Type | Description |
|---|---|---|
camera | FlxCamera | - |
Returns: this
destroy()
destroy(): voidReturns: void
fade()
fade(color?: number, duration?: number, onComplete?: FlxCameraEffectCallback | null, force?: boolean): voidParameters:
| Parameter | Type | Description |
|---|---|---|
color | number | - |
duration | number | - |
onComplete | FlxCameraEffectCallback | null | - |
force | boolean | - |
Returns: void
flash()
flash(color?: number, duration?: number, onComplete?: FlxCameraEffectCallback | null, force?: boolean): voidParameters:
| Parameter | Type | Description |
|---|---|---|
color | number | - |
duration | number | - |
onComplete | FlxCameraEffectCallback | null | - |
force | boolean | - |
Returns: void
focusOn()
focusOn(point: Readonly<PointLike>): voidParameters:
| Parameter | Type | Description |
|---|---|---|
point | Readonly<PointLike> | - |
Returns: void
follow()
follow(target: FlxObject | null, style?: FlxCameraFollowStyle): voidParameters:
| Parameter | Type | Description |
|---|---|---|
target | FlxObject | null | - |
style | FlxCameraFollowStyle | - |
Returns: void
getScale()
getScale(point?: FlxPoint): FlxPointParameters:
| Parameter | Type | Description |
|---|---|---|
point | FlxPoint | - |
Returns: FlxPoint
resize()
resize(width: number, height: number): voidParameters:
| Parameter | Type | Description |
|---|---|---|
width | number | - |
height | number | - |
Returns: void
screenToWorld()
screenToWorld(point: Readonly<PointLike>, output?: FlxPoint): FlxPointParameters:
| Parameter | Type | Description |
|---|---|---|
point | Readonly<PointLike> | - |
output | FlxPoint | - |
Returns: FlxPoint
setBounds()
setBounds(x?: number, y?: number, width?: number, height?: number, updateWorld?: boolean): voidParameters:
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
width | number | - |
height | number | - |
updateWorld | boolean | - |
Returns: void
setScale()
setScale(x: number, y?: number): voidParameters:
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
Returns: void
shake()
shake(intensity?: number, duration?: number, onComplete?: FlxCameraEffectCallback | null, force?: boolean, direction?: FlxCameraShakeDirection): voidParameters:
| Parameter | Type | Description |
|---|---|---|
intensity | number | - |
duration | number | - |
onComplete | FlxCameraEffectCallback | null | - |
force | boolean | - |
direction | FlxCameraShakeDirection | - |
Returns: void
stopFX()
stopFX(): voidReturns: void
takeSnapshot()
takeSnapshot(): Promise<{ height: number; pixels: Uint8ClampedArray; width: number; }>Asynchronously extracts rendered RGBA pixel data for this camera from the active host renderer.
Returns: Promise<{ height: number; pixels: Uint8ClampedArray; width: number; }>
update()
update(): voidReturns: void
updateWithElapsed()
updateWithElapsed(elapsed: number): voidAdvances follow state and effects with an explicit deterministic step.
Parameters:
| Parameter | Type | Description |
|---|---|---|
elapsed | number | - |
Returns: void
worldToScreen()
worldToScreen(point: Readonly<PointLike>, output?: FlxPoint, scrollFactor?: Readonly<PointLike>): FlxPointParameters:
| Parameter | Type | Description |
|---|---|---|
point | Readonly<PointLike> | - |
output | FlxPoint | - |
scrollFactor | Readonly<PointLike> | - |
Returns: FlxPoint