--!strict local ReplicatedStorage = game:GetService("ReplicatedStorage") local StarterGui = game:GetService("StarterGui") local Players = game:GetService("Players") local Shime = require(ReplicatedStorage.CORE.Utils.Shime) local Plr = Players.LocalPlayer :: Player const ReplayDelay = 1.5 const PresetOrder: { Shime.PresetName } = { "Default", "Soft", "Fast", "Slow", "Subtle", "Bright", "Loading", "PingPong", "Once", "Gold", "Ice", } local ShimmerPreviewController = { Name = "ShimmerPreviewController", Previews = {} :: { Shime.Shime }, Threads = {} :: { thread }, } local function GetTemplates(Content: Frame): { Frame } local Templates = {} for _, Child in Content:GetChildren() do if Child.Name == "Template" and Child:IsA("Frame") then table.insert(Templates, Child) end end return Templates end local function CreateLabel(Template: Frame, Source: TextLabel, Text: string) local Label = Source:Clone() Label.Name = "PresetName" Label.Text = Text Label.AnchorPoint = Vector2.new(0.5, 1) Label.Position = UDim2.fromScale(0.5, 0.95) Label.Size = UDim2.fromScale(0.9, 0.18) Label.ZIndex = 2 local Stroke = Instance.new("UIStroke") Stroke.Thickness = 1.5 Stroke.Transparency = 0.3 Stroke.Parent = Label Label.Parent = Template end local function KeepReplaying(Preview: Shime.Shime, Interval: number): thread return task.spawn(function() while Preview:GetFrame().Parent do task.wait(Interval) if Preview.PlaybackState == Enum.PlaybackState.Completed then Preview:Cancel() Preview:Play() end end end) end function ShimmerPreviewController:KnitStart() local PlayerGui = Plr:WaitForChild("PlayerGui") local Screen = PlayerGui:WaitForChild("ShimmerPreviews") local Content = Screen:WaitForChild("Background"):WaitForChild("Content") :: Frame local LabelSource = Content:WaitForChild("Title"):WaitForChild("Sub") :: TextLabel local Templates = GetTemplates(Content) StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false) for Index, PresetName in PresetOrder do local Template = Templates[Index] if not Template then break end Template.Name = PresetName Template.LayoutOrder = Index CreateLabel(Template, LabelSource, PresetName) local Preview = Shime.FromPreset(Template, PresetName) Preview:Play() table.insert(self.Previews, Preview) local Config = Shime.Presets[PresetName] if Config.RepeatCount >= 0 then local Passes = (Config.RepeatCount + 1) * (if Config.Reverses then 2 else 1) local Interval = Config.Duration * Passes + Config.DelayTime + ReplayDelay table.insert(self.Threads, KeepReplaying(Preview, Interval)) end end end function ShimmerPreviewController:Cleanup() for _, Thread in self.Threads do task.cancel(Thread) end for _, Preview in self.Previews do Preview:Stop() end table.clear(self.Threads) table.clear(self.Previews) end return ShimmerPreviewController