Studio

FolioTier 2

@pan

Pan the camera (in-world layers - backdrop + sprites) to an absolute (x, y) offset from stage center.

Use @pan to shift the camera to a specific position on stage, moving the backdrop and all sprites together as one world. The destination is always absolute - measured in pixels from stage center - so calling @pan twice with the same coordinates lands in the same place both times. Reach for it when you want to guide the reader's eye: sliding across a wide backdrop to reveal something off to one side, or re-centering after an earlier pan before a scene transition.

When you supply a sprite tag to target, only that layer moves; the backdrop and other sprites stay put. This lets you nudge a character toward the edge of frame while the background holds still, which reads as the character drifting rather than the whole world lurching. Keep in mind that a targeted pan stacks on top of any existing world-level pan, so if you have already shifted the frame with an untargeted call, the sprite moves relative to that already-shifted frame.

Setting wait to false lets you chain effects so a shake and a pan can run at the same time, but be careful with duration overlap - a second @pan fired before the first finishes will jump to the new target immediately, cutting the animation rather than blending it. If you need a sequence of smooth camera moves, wait between each call or choreograph the durations so they do not collide.

Parameters

ParameterKindRequiredDefaultNotes
xnumberno0-2000 to 2000 pixels. Default 0.
ynumberno0-2000 to 2000 pixels. Default 0.
durationnumberno10-30 seconds. Default 1.
targetstringno""Optional sprite tag; empty targets the whole frame.
waitbooleannofalseBlock for the effect's duration when true; false fires and continues so effects can overlap.

Canonical example

bg city-rooftop
@pan(2, x=120, y=0)
say "Liam": "There. Top floor."

@pan tweens the camera to an absolute offset (x, y) from the stage center. The camera frames the in-world layers - backdrop and sprites - but does not affect overlays (@flash, @fade, @dissolve snapshots) or stage shake. Pan and zoom compose independently.

Coordinate system

Positive x moves the camera target right (so the visible image shifts left). Positive y moves the camera target down. (0, 0) is the default - the camera centered on the stage.

@pan is absolute, not relative: calling @pan(x=80) twice does not pan 160 pixels. The second call is a no-op tween to a target the camera is already on.

Persistence across scenes

Camera state persists until explicitly reset. If you @pan(x=100) in one scene and the next scene begins without resetting, that scene also opens panned. To reset, fire @pan(0, x=0, y=0).

Notes

@pan runs on the Pixi stage.

See also

  • @zoom - absolute zoom (scale factor)
  • @kenburns - slow scale drift
  • @shake - stage-frame jitter (orthogonal to camera)
  • bg - backdrop change; does not auto-reset camera