Basics
Guides
API Reference
Basics
Guides
API Reference
[18:7] extends: FxObj
Wraps FXGL's Viewport (com.almasb.fxgl.app.scene.Viewport), the camera frame for a GameScene. The viewport controls which part of the game world is rendered: panning, following an entity, zoom, rotation, screen-shake, and fade / flash overlays all live here. Aussom users hold a Viewport wrapper via adopt after obtaining one from the running GameScene (typically fxgl.getGameScene().getViewport).
Viewport (InitialWidth = null, double InitialHeight = 0.0)
Creates a new Viewport with the given size. Pass null for InitialWidth to construct an empty wrapper for adopt.
InitialWidth is the viewport width in pixels, or null.InitialHeight is the viewport height in pixels.adopt (object Ajo)
Wraps an existing Viewport AussomJavaObject.
Ajo is an AussomJavaObject around a Viewport.A new wrapper.xProperty ()
Returns the read-only origin-X property.
An AussomJavaObject around a ReadOnlyDoubleProperty.yProperty ()
Returns the read-only origin-Y property.
An AussomJavaObject around a ReadOnlyDoubleProperty.getX ()
Returns the current origin X.
A double.setX (double X)
Sets the current origin X.
X is the new origin X.this objectgetY ()
Returns the current origin Y.
A double.setY (double Y)
Sets the current origin Y.
Y is the new origin Y.this objectgetOrigin ()
Returns the current viewport origin as a Point2D.
An AussomJavaObject around a Point2D.getVisibleArea ()
Returns the currently visible viewport area as a Rectangle2D (origin plus zoom-scaled width / height).
An AussomJavaObject around a Rectangle2D.getZoom ()
Returns the current zoom factor (1.0 = no zoom).
A double.setZoom (double Zoom)
Sets the zoom factor.
Zoom is the new zoom factor (>1 zooms in, <1 zooms out).this objectzoomProperty ()
Returns the zoom DoubleProperty for binding.
An AussomJavaObject around a SimpleDoubleProperty.getAngle ()
Returns the current viewport rotation in degrees.
A double.setAngle (double Angle)
Sets the viewport rotation in degrees.
Angle is the new rotation.this objectangleProperty ()
Returns the rotation DoubleProperty for binding.
An AussomJavaObject around a SimpleDoubleProperty.getWidth ()
Returns the current viewport width in pixels.
A double.setWidth (double W)
Sets the viewport width in pixels.
W is the new width.this objectwidthProperty ()
Returns the width DoubleProperty for binding.
An AussomJavaObject around a SimpleDoubleProperty.getHeight ()
Returns the current viewport height in pixels.
A double.setHeight (double H)
Sets the viewport height in pixels.
H is the new height.this objectheightProperty ()
Returns the height DoubleProperty for binding.
An AussomJavaObject around a SimpleDoubleProperty.isLazy ()
Returns whether the viewport follows its bound entity lazily (smoothed, asymptotic) rather than instantly.
A bool.setLazy (bool Lazy)
Sets the lazy-follow flag.
Lazy is the new flag value.this objectisFloating ()
Returns whether the viewport applies a noise-driven floating offset (gives a hand-held camera feel).
A bool.setFloating (bool Floating)
Sets the floating-camera flag.
Floating is the new flag value.this objectgetCamera ()
Returns the visual-effects camera Entity. Effects (like the flash overlay) attach to this entity's ViewComponent.
An AussomJavaObject around an Entity.bindToEntity (object EntityObj, double DistX, double DistY)
Binds the viewport origin to follow a target entity at a fixed offset.
EntityObj is an Entity wrapper.DistX is the X offset between origin and entity.DistY is the Y offset between origin and entity.this objectbindToFit (double XMargin, double YMargin, object EntitiesObj)
Binds the viewport to fit every given entity inside its frame, scaling the zoom to make them fit and translating to keep them centered (with optional margins).
XMargin is the horizontal margin in pixels.YMargin is the vertical margin in pixels.EntitiesObj is an AussomJavaObject around an Entity varargs array (or a single Entity).this objectunbind ()
Releases any viewport entity binding and zoom binding.
this objectsetBounds (int MinX, int MinY, int MaxX, int MaxY)
Sets the world bounds the viewport will not move past when following an entity.
MinX is the minimum X.MinY is the minimum Y.MaxX is the maximum X.MaxY is the maximum Y.this objectfocusOnEntity (object EntityObj)
Centers the viewport on the given entity's center.
EntityObj is an Entity wrapper.this objectfocusOn (double X, double Y)
Centers the viewport on the given (X, Y) world point.
X is the focus X.Y is the focus Y.this objectshake (double PowerTranslate, double PowerRotate)
Applies a combined translational and rotational shake for the given powers.
PowerTranslate is the translational shake power.PowerRotate is the rotational shake power.this objectshakeTranslational (double Power)
Applies a translational-only shake for the given power.
Power is the shake magnitude.this objectshakeRotational (double Power)
Applies a rotational-only shake for the given power.
Power is the rotation magnitude.this objectflash (callback Cb)
Triggers a white-screen flash overlay that fades out. The supplied callback runs when the fade finishes.
Cb is a callback with no arguments.this objectfade (callback Cb)
Triggers a fade-to-black overlay that fades in. The supplied callback runs when the fade finishes.
Cb is a callback with no arguments.this objectonUpdate (double Tpf)
Drives the viewport's per-frame logic (shake, fade / flash, bound-entity origin tracking). Normally invoked by the GameScene update loop; only call manually for standalone Viewport use.
Tpf is the per-frame time in seconds.this object
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.