curve
Curves: a number along a line, from 0 to 1, with an envelope round it (how far a value may stray), as a particle's size over its life has them. A curve is a value like a color: it can't be changed, and functions give new ones.
curve.newfunction
curve.new(keys: table): curveA curve from its keypoints, each written [time] = value or [time] = { value, envelope }: its time from 0 to 1, its value, and its envelope (how far each particle's own value may stray from it, either way; 0 when it is a value alone): curve.new({ [0] = 0.2, [0.3] = { 0.5, 0.1 }, [1] = 0 }). A list is spread evenly (curve.new({ 0, 1, 0 })). 16 keypoints at most.
| Value | Type | |
|---|---|---|
keys | table |
Gives: curve.
curve.lerpfunction
curve.lerp(a: curve, b: curve, t: number): curveThe same as a:lerp(b, t).
| Value | Type | |
|---|---|---|
a | curve | |
b | curve | |
t | number |
Gives: curve.
curve.keysfunction
c.keys: list of tableIts keypoints, in order: a list of tables with time, value and envelope. (A new list each time: changing it changes nothing.)
curve:valueAtfunction
c:valueAt(time: number): numberIts value at a time (the time runs from 0 to 1; the value is any number), in a straight line between two keypoints.
| Value | Type | |
|---|---|---|
time | number |
Gives: number.
curve:envelopeAtfunction
c:envelopeAt(time: number): numberIts envelope at a time, from 0 to 1.
| Value | Type | |
|---|---|---|
time | number |
Gives: number.
curve:reversefunction
c:reverse(): curveA new curve: the same keypoints the other way round.
Gives: curve.
curve:lerpfunction
c:lerp(other: curve, t: number): curveA curve between this one (t = 0) and the other (t = 1). With as many keypoints as each other, each keypoint glides to the other's, its time too. t is kept from 0 to 1.
| Value | Type | |
|---|---|---|
other | curve | |
t | number |
Gives: curve.