I want to create a smooth transition effect for frames. I’m kinda getting close, however I can’t think of a solution for the starting frame
-- Create stage frame
local function CreateStageFrame(currentDistance, color, stage)
local NewStage = StageTemplate:Clone()
NewStage.Size = UDim2.new(1, 0, currentDistance / TotalSize, 0)
NewStage.Name = stage
if PreviousColor then
local StartingColor = ColorSequenceKeypoint.new(0, color)
local FirstTransition = ColorSequenceKeypoint.new(0.3, color)
local SecondTransition = ColorSequenceKeypoint.new(0.7, PreviousColor)
local EndingColor = ColorSequenceKeypoint.new(1, PreviousColor)
NewStage.UIGradient.Color = ColorSequence.new({StartingColor, FirstTransition, SecondTransition, EndingColor})
else
end
PreviousColor = color
NewStage.Parent = Stages
return NewStage
end
The starting frame is stuck being plain white as it’s the first frame that’s created (and so a PreviosColor does not exist yet)