Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commita26cdab9a3

README.md

proc.anim

Values that change over a graph's time. An animated value is an InputRef (kind = "animated"), so it sits wherever a constant sits: any param of any node, any field of a record param, any element of an array, any socket. The evaluator resolves it at the graph's current time and hands the op the plain value, and the node's cook key folds that resolved value, so a node cooks again on the frames where a value it reads differs.

Four forms make one:

proc.anim.keys({ { 0, 10 }, { 2, 400, "smooth" }, { 5, 50 } }, { after = "loop" })
proc.anim.expr("8 + sin(t * 2) * 4")
proc.anim.math("mul", 60, proc.anim.expr("1 - t"))
proc.anim.input("distance")
  • keys(keys, { before?, after? }) interpolates numbers, records of numbers ({ x =, y =, z = }) and arrays of numbers component by component. Each key is { time, value, ease? } with time in seconds; ease shapes the segment arriving at the key: "linear" (default), "step", "smooth" or "cubic". before / after say what the value does outside its keys: "hold" (default), "loop", "pingpong" or "extend".
  • expr(source, vars?) is one Luau expression over t (seconds), frame, fps, duration, the math library's functions and constants by bare name, clamp, lerp, smoothstep and a deterministic noise(x); vars names further numbers it reads, each a number or another animated value.
  • math(op, a, b) is a <op> b at every time, op one of OPERATIONS (add, sub, mul, div, min, max, pow).
  • input(name) is the value a play's input name holds at the clock it is sampled at.

sample(anim, clock) answers the plain value at a clock ({ time, frame, fps, duration }); is, reads, inputNames, of, count and digest inspect animated values and the graphs that hold them.

Part of @builtin::systems.procgen.proc; reached as proc.anim.