Curve

Up and coming: shot check knows this datatype and its members today, and programs run it once the native runtime lands.

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.

Passes shot check todayLuau
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)
end

Constructors

NameArgumentsReturnsDescription
Curve.fromBezier(...number)Curve
Curve.fromFunction(f: (number) -> number, samples: number?)Curve
Curve.Named(name: CurveName)Curve

Properties

NameTypeDefaultDescription
Values{ number }The samples the curve was baked to: 512 for a bezier.

Methods

NameArgumentsReturnsDescription
Get(t: number)numberThe value at t, with t clamped to 0 to 1 and read linearly between samples.
GetVelocity(t: number)numberThe speed at t, scaled so the fastest point is 1.