Constructor

new()

Variables

@:value(0)x:Float = 0

Camera x position

@:value(0)y:Float = 0

Camera y position

@:value(false)followTarget:Bool = false

true if the camera should follow its target

@:value(true)clampToContentBounds:Bool = true

If true, camera will try to stay inside content bounds. If not possible, it will be centered.

@:value(0.02)brakeNearBoundsX:Float = 0.02

Percentage of viewport width where camera will "brake" to stay inside content bounds

@:value(0.03)brakeNearBoundsY:Float = 0.03

Percentage of viewport height where camera will "brake" to stay inside content bounds

@:value(0)targetX:Float = 0

Target x position

@:value(0)targetY:Float = 0

Target y position

@:value(20.0)trackSpeedX:Float = 20.0

Tracking x speed factor

@:value(15.0)trackSpeedY:Float = 15.0

Tracking y speed factor

@:value(0.8)trackCurve:Float = 0.8

Affects tracking curve. Should be above 0 and below or equal to 1.

@:value(1.0)zoom:Float = 1.0

Zoom scaling factor

@:value(0.04)deadZoneX:Float = 0.04

Horizontal dead zone (percentage between 0 and 1 relative to viewport width)

@:value(0.1)deadZoneY:Float = 0.1

Horizontal dead zone (percentage between 0 and 1 relative to viewport height)

@:value(1.0)frictionX:Float = 1.0

Horizontal friction. More the value is below 1.0, higher is the friction.

@:value(1.0)frictionY:Float = 1.0

Vertical friction. More the value is below 1.0, higher is the friction.

@:value(0)contentX:Float = 0

Content x (top left corner) position

@:value(0)contentY:Float = 0

Content y (top left corner) position

@:value(0)contentWidth:Float = 0

Content width

@:value(0)contentHeight:Float = 0

Content height

@:value(0)viewportWidth:Float = 0

Viewport width: the actual visible with on this camera

@:value(0)viewportHeight:Float = 0

Viewport height: the actual visible height on this camera

@:value(0.00001)movementThreshold:Float = 0.00001

A threshold value to stop the camera if its movement is lower than this value

@:value(0.0)contentTranslateX:Float = 0.0

Translation X that should be applied to the content so that the camera is pointing to the correct area. This value is computed by the camera when it is updated.

@:value(0.0)contentTranslateY:Float = 0.0

Translation Y that should be applied to the content so that the camera is pointing to the correct area This value is computed by the camera when it is updated.

Methods

inlinepos(x:Float, y:Float):Void

Set camera x & y position

Parameters:

x
null

y

inlinebrakeNearBounds(brakeNearBoundsX:Float, brakeNearBoundsY:Float):Void

Set brakeNearBoundsX& brakeNearBoundsY

Parameters:

brakeNearBoundsX
null

brakeNearBoundsY

inlinetarget(targetX:Float, targetY:Float):Void

Set targetX & targetY, which define the position the camera may follow if followTarget is true

Parameters:

targetX
null

targetY

Inherited Events

Defined by Entity

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by Entity

read onlyhasData:Bool

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

@editablecomponents:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by Entity

destroy():Void

Destroy this entity. This method is automatically protected from duplicate calls. That means calling multiple times an entity's destroy() method will run the destroy code only one time. As soon as destroy() is called, the entity is marked destroyed=true, even when calling destroy() method on a subclass (a macro is inserting a code to mark the object as destroyed at the beginning of every destroy() override function.

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

component<C>(?name:String, ?component:Null<C>):C