@usbx/sequence
Cutscenes on a timeline
local sequence = require("@usbx/sequence")
Plays a Sequence for the players and returns it at once. Its markers and completed fire at their times.
Use it forplaying an intro cutscene for a player the moment they reach the boss room.
targetoptionalOne player, a list of players, or nil for every player in the game now.
definitionThe duration, the tracks and the markers.
Build a play callduration · tracks · markers
A camera track: the shots of the Sequence's players. A Sequence has at most one.
example
local shot = sequence.camera({ { time = 0, position = math3d.vector3.new(0, 5, 20), look_at = door.position }, { time = 3, position = math3d.vector3.new(8, 3, 6), look_at = door.position, easing = "sine_in_out" } })
Use it forflying the camera around the arena to show it off before a round starts.
keysCamera keys in time order: time, position and look_at, and fov, easing or cut.
sequence.caption
function#A caption track: lines of text at the bottom of the screen.
example
local line = sequence.caption({ { time = 0.5, text = "[b]Sensei![/b] You made it." }, { time = 2.5, text = "Now watch.", duration = 1.5 } })
Use it forshowing a character's lines at the bottom of the screen during a story cutscene.
keysCaption keys in time order: time and text, and duration.
An effect track: explosions that only the Sequence's players see.
example
local blast = sequence.effect({ { time = 2, position = door.position, size = 8 } })
Use it forblowing up the gate at an exact moment in a cutscene.
keysEffect keys in time order: time, position and size, and effect or color.
sequence.time_scale
function#A slow-motion track. Slows what the Sequence's players see.
example
local slow = sequence.time_scale({ { time = 1, scale = 0.3 }, { time = 2, scale = 1, easing = "quad_out" } })
Use it forslowing down the final hit of a boss fight.
keysTime-scale keys in time order: time and scale, 0.1 to 2, and easing or cut.
A tween track: moves, turns, colors or fades an instance, for every player. An instance has at most one tween track in a Sequence.
example
local lift = sequence.tween(door, { { time = 0, position = door.position }, { time = 2, position = door.position + math3d.vector3.new(0, 8, 0), easing = "quad_out" } })
Use it forraising a door or moving a platform as part of a cutscene.
instanceThe instance the track moves, for every player.
keysTween keys in time order: time and a position, rotation, color or transparency, and easing or cut.