From a50893c34deceec827e238fc1efd05f9d7151b71 Mon Sep 17 00:00:00 2001 From: Siliqon <74933065+SiliqonDev@users.noreply.github.com> Date: Sat, 4 Apr 2026 00:45:15 +0530 Subject: [PATCH] implement better progress bar display method swap out old method to use gradient instead and avoid the clipping issue that occurs when `Progress` is a very low value or 0 --- src/Components/ProgressBar.luau | 38 ++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/Components/ProgressBar.luau b/src/Components/ProgressBar.luau index dd5cb4f..b233b93 100644 --- a/src/Components/ProgressBar.luau +++ b/src/Components/ProgressBar.luau @@ -79,17 +79,7 @@ return function(Scope: Fusion.Scope, Props: Props) Scope:Frame { Name = "ProgressFill", Selectable = false, - Size = Scope:Spring( - Scope:Computed(function(Use) - if Use(Direction) == Enum.FillDirection.Horizontal then - return UDim2.fromScale(Use(Progress), 1) - else - return UDim2.fromScale(1, Use(Progress)) - end - end), - Theme.SpringSpeed["0.5"], - Theme.SpringDampening["1"] - ), + Size = UDim2.fromScale(1, 1), AnchorPoint = Scope:Computed(function(Use) if Use(Inverted) then if Use(Direction) == Enum.FillDirection.Horizontal then @@ -112,8 +102,32 @@ return function(Scope: Fusion.Scope, Props: Props) return UDim2.fromScale(0, 0) end end), - AutomaticSize = Enum.AutomaticSize.None, + Gradient = { + Transparency = Scope:Computed(function(Use) + if Use(Inverted) then + return NumberSequence.new{ + NumberSequenceKeypoint.new(0, 1), + NumberSequenceKeypoint.new(.001, 0), + NumberSequenceKeypoint.new(1, 0), + } + else + return NumberSequence.new{ + NumberSequenceKeypoint.new(0, 0), + NumberSequenceKeypoint.new(.001, 1), + NumberSequenceKeypoint.new(1, 1), + } + end + end), + Offset = Scope:Computed(function(Use) + local progress = Use(Progress) + if Use(Inverted) then + progress = 1 - progress + end + return Vector2.new(progress, 0) + end), + }, BackgroundTransparency = 0, + AutomaticSize = Enum.AutomaticSize.None, BackgroundColor3 = Color, Stroke = { Color = Color3.fromRGB(255, 255, 255),