camera — Luau Binding
require("camera"): the viewport transform over the whole stage — follow, shake, zoom, bounds. The programmatic surface of the camera system. Every function is[antos].
Status: design. Not built yet.
local camera = require("camera")
| Call | Returns | Does |
|---|---|---|
camera.follow(target, opts?) |
ok |
track target — opts = { smoothing = 0, deadzone, bounds } |
camera.shake(amount, secs?) |
ok |
a decaying impact wobble, from the seeded PRNG — deterministic |
camera.zoom(z) / camera.rotate(d) |
ok |
scale / turn the view |
camera.move(x, y) |
ok |
place the view directly (stops following) |
camera.bounds(x1, y1, x2, y2) |
ok |
clamp the view to a world rectangle |
local camera = require("camera")
camera.bounds(0, 0, level.w, level.h)
camera.follow(hero, { smoothing = 0.15, deadzone = 48 })
collision.on("enter", function(a, b) if a == hero then camera.shake(6, 0.3) end end)