Constructor
Camera(parent: Object?, x: number?, y: number?, width: number?, height: number?, keep_in_bounds: boolean?)
Arguments:
parent: Object? | The base class of all objects in Kristal. |
x: number? | |
y: number? | |
width: number? | |
height: number? | |
keep_in_bounds: boolean? |
Methods
Camera:applyTo(transform: love.Transform, ceil_x: number?, ceil_y: number?)
Arguments:
transform: love.Transform | Object containing a coordinate system transformation. The love.graphics module has several functions and function variants which accept Transform objects. |
ceil_x: number? | |
ceil_y: number? |
Camera:approachDirect(x: number, y: number, amount: number)
Arguments:
x: number | |
y: number | |
amount: number |
Camera:beginAttached(last_state: string, attach_x: boolean?, attach_y: boolean?)
Arguments:
last_state: string | |
attach_x: boolean? | |
attach_y: boolean? |
Camera:getMaxPosition(bx: number, by: number, bw: number, bh: number)
Arguments:
bx: number | |
by: number | |
bw: number | |
bh: number |
Returns:
x: number | |
y: number |
Camera:getMinPosition(bx: number, by: number, bw: number, bh: number)
Arguments:
bx: number | |
by: number | |
bw: number | |
bh: number |
Returns:
x: number | |
y: number |
Camera:getParallax(px: number, py: number, ox: number?, oy: number?)
Arguments:
px: number | |
py: number | |
ox: number? | |
oy: number? |
Returns:
x: number | |
y: number |
Camera:getRect(scaled: boolean?)
Arguments:
scaled: boolean? |
Returns:
x: number | |
y: number | |
width: number | |
height: number |
Camera:moveTo(x: number, y: number)
Arguments:
x: number | |
y: number |
Returns:
static_x: boolean | |
static_y: boolean |
Camera:panTo(x: number, y: number, time: number, ease: easetype?, after: fun()?)
ease:
| "linear"
| "in-quad"
| "in-cubic"
| "in-quart"
| "in-quint"
| "in-sine"
| "in-expo"
| "in-circ"
| "in-back"
| "in-bounce"
| "in-elastic"
| "out-quad"
| "out-cubic"
| "out-quart"
| "out-quint"
| "out-sine"
| "out-expo"
| "out-circ"
| "out-back"
| "out-bounce"
| "out-elastic"
| "in-out-quad"
| "in-out-cubic"
| "in-out-quart"
| "in-out-quint"
| "in-out-sine"
| "in-out-expo"
| "in-out-circ"
| "in-out-back"
| "in-out-bounce"
| "in-out-elastic"
| "inQuad"
| "outQuad"
| "inOutQuad"
| "outInQuad"
| "inCubic"
| "outCubic"
| "inOutCubic"
| "outInCubic"
| "inQuart"
| "outQuart"
| "inOutQuart"
| "outInQuart"
| "inQuint"
| "outQuint"
| "inOutQuint"
| "outInQuint"
| "inSine"
| "outSine"
| "inOutSine"
| "outInSine"
| "inExpo"
| "outExpo"
| "inOutExpo"
| "outInExpo"
| "inCirc"
| "outCirc"
| "inOutCirc"
| "outInCirc"
| "inElastic"
| "outElastic"
| "inOutElastic"
| "outInElastic"
| "inBack"
| "outBack"
| "inOutBack"
| "outInBack"
| "inBounce"
| "outBounce"
| "inOutBounce"
| "outInBounce"
| "linear"
| "in-quad"
| "in-cubic"
| "in-quart"
| "in-quint"
| "in-sine"
| "in-expo"
| "in-circ"
| "in-back"
| "in-bounce"
| "in-elastic"
| "out-quad"
| "out-cubic"
| "out-quart"
| "out-quint"
| "out-sine"
| "out-expo"
| "out-circ"
| "out-back"
| "out-bounce"
| "out-elastic"
| "in-out-quad"
| "in-out-cubic"
| "in-out-quart"
| "in-out-quint"
| "in-out-sine"
| "in-out-expo"
| "in-out-circ"
| "in-out-back"
| "in-out-bounce"
| "in-out-elastic"
| "inQuad"
| "outQuad"
| "inOutQuad"
| "outInQuad"
| "inCubic"
| "outCubic"
| "inOutCubic"
| "outInCubic"
| "inQuart"
| "outQuart"
| "inOutQuart"
| "outInQuart"
| "inQuint"
| "outQuint"
| "inOutQuint"
| "outInQuint"
| "inSine"
| "outSine"
| "inOutSine"
| "outInSine"
| "inExpo"
| "outExpo"
| "inOutExpo"
| "outInExpo"
| "inCirc"
| "outCirc"
| "inOutCirc"
| "outInCirc"
| "inElastic"
| "outElastic"
| "inOutElastic"
| "outInElastic"
| "inBack"
| "outBack"
| "inOutBack"
| "outInBack"
| "inBounce"
| "outBounce"
| "inOutBounce"
| "outInBounce"
Arguments:
x: number | |
y: number | |
time: number | |
ease: easetype? | |
after: fun()? |
Returns:
1: boolean |
Camera:panToSpeed(x: number, y: number, speed: number, after: fun()?)
Arguments:
x: number | |
y: number | |
speed: number | |
after: fun()? |
Returns:
1: boolean |
Camera:processMod(name: string, mod: Camera.modifier, x: number, y: number)
Arguments:
name: string | |
mod: Camera.modifier | |
x: number | |
y: number |
Returns:
x: number? | |
y: number? |
Camera:setAttached(attached_x: boolean?, attached_y: boolean?)
Arguments:
attached_x: boolean? | |
attached_y: boolean? |
Camera:setBounds(x: number, y: number, width: number, height: number)
Arguments:
x: number | |
y: number | |
width: number | |
height: number |
Camera:setModifier(name: string, value: any, approach_speed: number?, approach_type: ("instant"|"speed"|"time")?)
approach_type:
| "time"
| "speed"
| "instant"
Arguments:
name: string | |
value: any | |
approach_speed: number? | |
approach_type: ("instant"|"speed"|"time")? |
Fields
Camera.attached_x: boolean
Whether the camera is attached to the target (x-axis).
Camera.attached_y: boolean
Whether the camera is attached to the target (y-axis).
Camera.bounds: table|nil
Camera bounds (for clamping).
Camera.default_approach_speed: number
Default modifier approach speed.
Camera.default_approach_time: number
Default modifier approach time.
Camera.height: number
Height of the camera (usually SCREEN_HEIGHT
).
Camera.keep_in_bounds: boolean
Whether the camera should stay in bounds.
Camera.lerper: table
Current modifier approach settings.
Camera.mod_order: string[]
Order camera modifiers are processed in.
Camera.mods: table<string, Camera.modifier>
Camera modifiers (position, offset, bounds - smoothly transitioned between).
Camera.pan_target: table|nil
Camera pan target (for automatic panning).
Camera.rotation: number
Camera rotation (radians).
Camera.shake_friction: number
Camera shake friction (how much the shake decreases).
Camera.shake_timer: number
Camera shake timer (used to invert the shake).
Camera.shake_x: number
Camera shake (x-axis).
Camera.shake_y: number
Camera shake (y-axis).
Camera.state: string
The current camera state.
Camera.state_manager: StateManager
Manages the camera state.
Camera.target: Object|nil
Camera target.
Camera.target_getter: fun()Object|nil
Optional function to get the camera target, if not set explicitly.
Camera.updated_mods: boolean
Whether modifiers have been updated this frame.
Camera.width: number
Width of the camera (usually SCREEN_WIDTH
).
Camera.zoom_x: number
Camera zoom (x-axis).
Camera.zoom_y: number
Camera zoom (y-axis).