BonfireCamera class
- Available extensions
Constructors
- BonfireCamera.new(CameraConfig config)
Properties
- angle ↔ double
-
getter/setter pair
- cameraRect → Rect
-
no setter
- cameraRect → Rect
-
Available on Camera, provided by the CameraExt extension
no setter - cameraRectWithSpacing → Rect
-
no setter
- cameraRectWithSpacing → Rect
-
Available on Camera, provided by the CameraExt extension
no setter - canvasSize → Vector2
-
no setterinherited
- combinedProjector → Projector
-
no setterinherited
- defaultShakeDuration ↔ double
-
getter/setter pairinherited
- defaultShakeIntensity ↔ double
-
getter/setter pairinherited
- follow ↔ Vector2?
-
If set, the camera will "follow" this vector, making sure that this
vector is always rendered in a fixed position in the screen, by
immediately moving the camera to "focus" on the where the vector is.
getter/setter pairinherited
- gameRef ↔ BonfireGame
-
getter/setter pair
- gameSize → Vector2
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isMoving → bool
-
no setter
- isMoving → bool
-
Available on Camera, provided by the CameraExt extension
no setter - limitMaxX ↔ double
-
getter/setter pair
- limitMaxY ↔ double
-
getter/setter pair
- limitMinX ↔ double
-
getter/setter pair
- limitMinY ↔ double
-
getter/setter pair
- moveOnlyMapArea ↔ bool
-
getter/setter pair
- position → Vector2
-
This is the current position of the camera, ie the world coordinate that
is rendered on the top left of the screen (origin of the screen space).
no setterinherited
- relativeOffset → Vector2
-
Where in the screen the follow object should be.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- screenCenter ↔ Offset
-
getter/setter pair
- setZoomLimitToFitMap ↔ bool
-
getter/setter pair
- shaking → bool
-
Whether the camera is currently shaking or not.
no setterinherited
- sizeMovementWindow ↔ Vector2
-
getter/setter pair
- smoothCameraEnabled ↔ bool
-
getter/setter pair
- speed ↔ double
-
getter/setter pairinherited
- target ↔ GameComponent?
-
Available on Camera, provided by the CameraExt extension
getter/setter pair - target ↔ GameComponent?
-
getter/setter pair
- viewport ↔ Viewport
-
getter/setter pairinherited
- worldBounds ↔ Rect?
-
If set, this determines boundaries for the camera movement.
getter/setter pairinherited
- zoom ↔ double
-
If set, the camera will zoom by this ratio. This can be greater than 1
(zoom in) or smaller (zoom out), but should always be greater than zero.
getter/setter pairinherited
Methods
-
absoluteTarget(
) → Vector2 -
This is the (current) absolute target of the camera, i.e., the
coordinate that should with
relativeOffset
taken into consideration but regardless of world boundaries or shake.inherited -
animateLoopRotation(
{required List< double> angles, required int repeatCount, bool normalizeOnFinish = true, List<Duration> ? pauseDuration, List<Duration> ? rotationDuration, List<Curve> ? curves, VoidCallback? onFinish}) → void -
animateSimpleRotation(
{required double angle, Duration? duration, VoidCallback? onFinish, Curve curve = Curves.decelerate}) → void -
animateZoom(
{required double zoom, Duration? duration, VoidCallback? finish, Curve curve = Curves.decelerate}) → void -
animateZoom(
{required double zoom, Duration? duration, VoidCallback? finish, Curve curve = widget.Curves.decelerate}) → void -
Available on Camera, provided by the CameraExt extension
-
apply(
Canvas canvas) → void -
Use this method to transform the canvas using the current rules provided
by this camera object.
inherited
-
contains(
Offset c) → bool -
contains(
Offset c) → bool -
Available on Camera, provided by the CameraExt extension
-
followComponent(
PositionComponent component, {Anchor relativeOffset = Anchor.center, Rect? worldBounds}) → void -
Immediately snaps the camera to start following the
component
. -
followVector2(
Vector2 vector2, {Anchor relativeOffset = Anchor.center, Rect? worldBounds}) → void -
Immediately snaps the camera to start following
vector2
. -
handleResize(
Vector2 canvasSize) → void -
inherited
-
isComponentOnCamera(
GameComponent c) → bool -
isComponentOnCamera(
GameComponent c) → bool -
Available on Camera, provided by the CameraExt extension
-
isRectOnCamera(
Rect c) → bool -
isRectOnCamera(
Rect c) → bool -
Available on Camera, provided by the CameraExt extension
-
moveDown(
double displacement) → void -
moveDown(
double displacement) → void -
Available on Camera, provided by the CameraExt extension
-
moveLeft(
double displacement) → void -
moveLeft(
double displacement) → void -
Available on Camera, provided by the CameraExt extension
-
moveRight(
double displacement) → void -
moveRight(
double displacement) → void -
Available on Camera, provided by the CameraExt extension
-
moveTo(
Vector2 position) → void -
Applies an ad-hoc movement to the camera towards the target, bypassing
follow. Once it arrives the camera will not move until
resetMovement
is called.inherited -
moveTop(
double displacement) → void -
moveTop(
double displacement) → void -
Available on Camera, provided by the CameraExt extension
-
moveToPlayer(
) → void -
moveToPlayerAnimated(
{Duration? duration, VoidCallback? finish, double? zoom, double? angle, Curve curve = widget.Curves.decelerate}) → void -
Available on Camera, provided by the CameraExt extension
-
moveToPlayerAnimated(
{Duration? duration, VoidCallback? finish, double? zoom, double? angle, Curve curve = Curves.decelerate}) → void -
moveToPosition(
Vector2 position) → void -
moveToPositionAnimated(
Vector2 position, {double? zoom, double? angle, VoidCallback? finish, Duration? duration, Curve curve = Curves.decelerate}) → void -
moveToPositionAnimated(
Vector2 position, {double? zoom, double? angle, VoidCallback? finish, Duration? duration, Curve curve = widget.Curves.decelerate}) → void -
Available on Camera, provided by the CameraExt extension
-
moveToTarget(
GameComponent? target) → void -
moveToTargetAnimated(
GameComponent target, {double? zoom, double? angle, VoidCallback? finish, Duration? duration, Curve curve = widget.Curves.decelerate}) → void -
Available on Camera, provided by the CameraExt extension
-
moveToTargetAnimated(
GameComponent target, {double? zoom, double? angle, VoidCallback? finish, Duration? duration, Curve curve = Curves.decelerate}) → void -
moveUp(
double displacement) → void -
Available on Camera, provided by the CameraExt extension
-
moveUp(
double displacement) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onGameResize(
Vector2 canvasSize) → void -
onGameResize(
Vector2 canvasSize) → void -
Available on Camera, provided by the CameraExt extension
-
onPositionUpdate(
Vector2 position) → void -
If you need updated on when the position of the camera is updated you
can override this.
inherited
-
projectVector(
Vector2 worldCoordinates) → Vector2 -
Converts a vector in the world space to the screen space.
inherited
-
resetMovement(
) → void -
Smoothly resets any moveTo targets.
inherited
-
scaleVector(
Vector2 worldCoordinates) → Vector2 -
Converts a vector representing a delta in the world space to the screen
space.
inherited
-
screenToWorld(
Vector2 screenCoordinates) → Vector2 -
Takes coordinates in the screen space and returns their counter-part in
the world space.
inherited
-
setGame(
BonfireGame game) → void -
Available on Camera, provided by the CameraExt extension
-
setRelativeOffset(
Anchor newRelativeOffset) → void -
This will trigger a smooth transition to a new relative offset.
inherited
-
shake(
{double? duration, double? intensity}) → void -
Applies a shaking effect to the camera for
duration
seconds and withintensity
expressed in pixels.inherited -
snap(
) → void -
Use this to immediately "snap" the camera to where it should be right
now. This bypasses any currently smooth transitions and might be janky,
but can be used to setup after a new world transition for example.
inherited
-
snapTo(
Vector2 position) → void - Instantly moves the camera to the target, bypassing follow. This will replace any previous targets.
-
toString(
) → String -
A string representation of this object.
inherited
-
translateBy(
Vector2 displacement) → void -
Moves the camera by a given
displacement
(delta). This is the same asmoveTo
but instead of providing an absolute end position, you can provide a desired translation vector.inherited -
unprojectVector(
Vector2 screenCoordinates) → Vector2 -
Converts a vector in the screen space to the world space.
inherited
-
unscaleVector(
Vector2 screenCoordinates) → Vector2 -
Converts a vector representing a delta in the screen space to the world
space.
inherited
-
update(
double dt) → void -
This smoothly updates the camera for an amount of time
dt
. -
updateSpacingVisibleMap(
double space) → void -
Available on Camera, provided by the CameraExt extension
-
updateSpacingVisibleMap(
double space) → void -
worldToScreen(
Vector2 worldCoordinates) → Vector2 -
Takes coordinates in the world space and returns their counter-part in
the screen space.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited