Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 07158574-5…

numberSequence

Roblox-shaped scalar keyframe-curve value type. A `NumberSequence` is an immutable curve of up to 64 keypoints, each carrying `(time, value, envelope)`. The envelope is a per-keypoint random range half-width applied at `:sample(t)` time; `:evaluate(t)` is always deterministic.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 2mo ago
What it does

numberSequence

Roblox-shaped scalar keyframe-curve value type. A NumberSequence is an immutable curve of up to 64 keypoints, each carrying (time, value, envelope). The envelope is a per-keypoint random range half-width applied at :sample(t) time; :evaluate(t) is always deterministic.

Exposed as the NumberSequence Luau global via --!global. Authored scripts call NumberSequence.new(...) directly without a require. The Rust FFI lives at __sequences.* (registered by crates/zero_scripting/src/ffi/bindings/curves.rs); this module is the typed Luau wrapper.

Exports

  • NumberSequence.new(...) -> NumberSequenceObj — three signatures:
    • NumberSequence.new(v) — constant value across [0, 1].
    • NumberSequence.new(v0, v1) — two-point lerp from v0 to v1.
    • NumberSequence.new({ { time, value, envelope? }, ... }) — explicit keypoints. envelope defaults to 0. First key must anchor at time = 0, last at time = 1. NaN / Inf rejected.
  • NumberSequence.deserialize(payload) -> NumberSequenceObj — rebuild from a { kind = "NumberSequence", keypoints = {...} } payload produced by :serialize().

Methods (called via :)

  • seq:evaluate(t) -> number — deterministic linear interpolation at t. t clamps to [0, 1]; NaN coerces to 0.
  • seq:sample(t) -> number — evaluate(t) + (math.random() − 0.5)·2·envelope(t). Per-VM math.randomseed controls jitter reproducibility.
  • seq:keypoints() -> { NumberKeypoint } — array snapshot, sorted ascending by time.
  • seq:duration() -> number — always 1.0 for a well-formed sequence.
  • seq:serialize() -> { kind, keypoints } — scene-save payload.
  • seq:destroy() — drop the FFI handle. Luau removed __gc on tables, so eager cleanup is the caller's responsibility for per-frame-rebuild patterns; otherwise the entry dies with the VM.

Substrate

Backed by zero_curves::Channel (Linear interp). Each sequence builds the value and envelope channels once at construct time and reaches into them on every sample — zero per-call allocation, safe for hot particle loops. Validation errors name the specific rule ("first keypoint must anchor at time = 0", "too many keypoints (max 64)", …).

Foundation for VFX property-over-lifetime: declarative particles (#2572), GPU emitter (#873), beams, trails. Issue: #2673.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

global NumberSequence

isArray(v: any) → boolean

argtypedescription
vany

normalizeInput(...: ?) → void

argtypedescription
...?

evaluate(self: any, t: number) → number

argtypedescription
selfany
tnumber

sample(self: any, t: number) → number

argtypedescription
selfany
tnumber

keypoints(self: any) → void

argtypedescription
selfany

duration(self: any) → number

argtypedescription
selfany

serialize(self: any) → any

argtypedescription
selfany

destroy(self: any) → void

argtypedescription
selfany

__tostring(self: any) → void

argtypedescription
selfany

new(...: any) → NumberSequenceObj

Construct a NumberSequence from one of three signatures: a constant value, a two-point lerp from `v0` to `v1`, or a keypoints array of `{ time, value, envelope? }` records. Envelope defaults to 0 when omitted. Up to 64 keypoints; the first must anchor at `time = 0`, the last at `time = 1`. NaN / Inf in `time` / `value` / `envelope` is rejected.

argtypedescription
...any`(v)`, `(v0, v1)`, or `({ {time, value, envelope?}, ... })`.

examples

local fade = NumberSequence.new(1.0)
local fadeOut = NumberSequence.new(1.0, 0.0)
local size = NumberSequence.new({{time=0,value=0.5,envelope=0.1},{time=0.5,value=1.5},{time=1,value=0}})

deserialize(data: any) → NumberSequenceObj

Rebuild a NumberSequence from a `{kind = "NumberSequence", keypoints = {...}}` payload produced by `:serialize()`. Used by scene save/load.

argtypedescription
dataanyThe serialized payload.

examples

local s = NumberSequence.deserialize(savedData)
⌬ Types
NumberKeypoint = {NumberSequenceObj = {

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

2items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · modules/numberSequence.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.