API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classCamera

@codexo/exojs / rendering / stable

User-facing camera abstraction. Extends View with ergonomic construction defaults. Use as the default camera owned by RenderingContext or pass custom instances to `context.render(node, { view: myCamera })`. ```ts const cam = new Camera({ center: { x: 50, y: 50 }, size: { width: 800, height: 600 } }); ``` Defaults: center `(0, 0)`, size `{ width: 0, height: 0 }`, full viewport `(0, 0, 1, 1)`, rotation `0`, zoom `1`.

8
props
27
methods
0
events
Import
import { Camera } from '@codexo/exojs'

User-facing camera abstraction. Extends View with ergonomic construction defaults. Use as the default camera owned by RenderingContext or pass custom instances to `context.render(node, { view: myCamera })`.

```ts const cam = new Camera({ center: { x: 50, y: 50 }, size: { width: 800, height: 600 } }); ```

Defaults: center `(0, 0)`, size `{ width: 0, height: 0 }`, full viewport `(0, 0, 1, 1)`, rotation `0`, zoom `1`.

Constructors 1
new(options: CameraOptions): Camera
Methods 27
clearBounds(): this
clearFollow(): this
destroy(): void
follow(target: ViewFollowTarget, options: ViewFollowOptions): this
getBounds(): Rectangle
getInverseTransform(): Matrix
getTransform(): Matrix
move(x: number, y: number): this
reset(centerX: number, centerY: number, width: number, height: number): this
resize(width: number, height: number): this
rotate(degrees: number): this
screenToWorld(x: number, y: number): PointLike
screenToWorld(screenX: number, screenY: number, canvasWidth: number, canvasHeight: number): PointLike
setBounds(bounds: Rectangle | null): this
setCenter(x: number, y: number): this
setRotation(degrees: number): this
setZoom(zoom: number): this
shake(intensity: number, durationMs: number, options: ViewShakeOptions): this
stopShake(): this
update(deltaMilliseconds: number): this
updateBounds(): this
updateTransform(): this
worldToScreen(worldX: number, worldY: number): PointLike
worldToScreen(worldX: number, worldY: number, canvasWidth: number, canvasHeight: number): PointLike
zoom(factor: number): this
zoomIn(amount: number): this
zoomOut(amount: number): this
Properties 8
center: ObservableVector
height: number
rotation: number
size: ObservableSize
updateId: number
viewport: Rectangle
width: number
zoomLevel: number
Source