Curve
Up and coming: shot check knows this datatype and its members today, and programs run it once the native runtime lands.
comingWindows and UI
Up and coming
Easing curves as values: build one from bezier points or a function, read its value or speed at any point, and hand it to a Transition.
Curve.fromBezier(x1, y1, x2, y2, ...) makes a multi-point bezier baked to 512 samples, Curve.fromFunction samples a function once, and Curve.Named gives the curves a Transition names. Get(t) clamps t to 0 to 1 and reads linearly between samples. GetVelocity(t) is scaled so the fastest point is 1, so a curve that ends flat still gives finite speeds.
local function example(x : Curve)
local curve = Curve.fromBezier(0, 0, 0.4, 1, 1, 1)
local eased : number = curve:Get(0.5)
print(eased, Transition.new(0.5, curve).Seconds)
endConstructors
| Name | Arguments | Returns | Description |
|---|---|---|---|
| Curve.fromBezier | (...number) | Curve | |
| Curve.fromFunction | (f: (number) -> number, samples: number?) | Curve | |
| Curve.Named | (name: CurveName) | Curve |
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| Values | { number } | The samples the curve was baked to: 512 for a bezier. |
Methods
| Name | Arguments | Returns | Description |
|---|---|---|---|
| Get | (t: number) | number | The value at t, with t clamped to 0 to 1 and read linearly between samples. |
| GetVelocity | (t: number) | number | The speed at t, scaled so the fastest point is 1. |
