I just thought it would be nice to add more sequence types (like NumberSequence) but with easing support with it’s own GetValue
method.
I copied the behavior of NumberSequence/ColorSequence pretty much 1:1 so it should be reverse compatible with any existing code.
--!strict
local NumberSequence = require(script.Parent.NumberSequence)
local NumberSequenceKeypoint = require(script.Parent.NumberSequence.NumberSequenceKeypoint)
type NumberSequence = NumberSequence.NumberSequence
type NumberSequenceKeypoint = NumberSequenceKeypoint.NumberSequenceKeypoint
local sequence: NumberSequence = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0), -- By default, it uses Enum.EasingStyle.Linear and Enum.EasingDirection.InOut
NumberSequenceKeypoint.new(0.5, 5, Enum.EasingStyle.Quad),
NumberSequenceKeypoint.new(1, 10, Enum.EasingStyle.Quint, Enum.EasingDirection.Out),
})
for i = 0, 1, 0.01 do
print(sequence:GetValue(i))
end
Download: Sequences.rbxm (7.3 KB)
The file currently has NumberSequence*, Color3Sequence, UDim2Sequence, Vector2Sequence, Vector3Sequence, and CFrameSequence.
* Overrides the existing built-in keywords, but essentially functions the same.
All of these modules have the same constructor.
Before you ask: yes, this can be under one module, but I just wanted to (re)use the default constructor. Feel free to do it yourself.