--!strict local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local Transition = require(ReplicatedStorage.CORE.Utils.Transition) local Plr = Players.LocalPlayer :: Player const PresetOrder: { Transition.PresetName } = { "Fade", "FadeWhite", "Flash", "SlideLeft", "SlideRight", "SlideUp", "SlideDown", "WipeRight", "WipeDown", "SoftWipe", "Circle", "Bars", "Blinds", } const Tints = { Color3.new(1, 1, 1), Color3.fromRGB(255, 190, 140), Color3.fromRGB(150, 200, 255), Color3.fromRGB(190, 255, 170), } const BgColors = { Color3.fromRGB(22, 22, 26), Color3.fromRGB(14, 22, 40), Color3.fromRGB(34, 16, 40), Color3.fromRGB(12, 34, 26), } const LoopDelay = 0.8 const StartOffset = 0.1 local TransitionTestController = { Name = "TransitionTestController", Cards = {} :: { Transition.Transition }, Fullscreen = {} :: { [string]: Transition.Transition }, } local function FindTemplates(Holder: Instance): { CanvasGroup } local Templates = {} :: { CanvasGroup } for _, Child in Holder:GetChildren() do if Child.Name == "Template" and Child:IsA("CanvasGroup") then table.insert(Templates, Child) end end table.sort(Templates, function(A: CanvasGroup, B: CanvasGroup): boolean return A.LayoutOrder < B.LayoutOrder end) return Templates end local function Cycle(Index: number, Count: number): number return Index % Count + 1 end function TransitionTestController:KnitStart() local PlayerGui = Plr:WaitForChild("PlayerGui") local Screen = PlayerGui:WaitForChild("TransitionPreviews") local Bg = Screen:WaitForChild("Background") :: Frame local Content = Bg:WaitForChild("Content") local Overlay = PlayerGui:WaitForChild("TransitionOverlay") :: ScreenGui local Templates = FindTemplates(Content) local BgIndex = 1 local function AnyPlaying(): boolean for _, Fx in self.Fullscreen do if Fx:IsBusy() then return true end end return false end local function PlayFullscreen(Name: Transition.PresetName) if AnyPlaying() then return end local Fx = self.Fullscreen[Name] or Transition.FromPreset(Overlay, Name) self.Fullscreen[Name] = Fx Fx:Play(function() BgIndex = Cycle(BgIndex, #BgColors) Bg.BackgroundColor3 = BgColors[BgIndex] end) end for Index, Name in PresetOrder do local Card = Templates[Index] if not Card then break end local Image = Card:WaitForChild("Preview") :: ImageLabel local NameLabel = Card:WaitForChild("PresetName") :: TextLabel local Button = Card:WaitForChild("Hitbox") :: TextButton local Fx = Transition.FromPreset(Card, Name) local Tint = 1 Card.Name = Name NameLabel.Text = Name table.insert(self.Cards, Fx) local function Loop() Fx:Play(function() Tint = Cycle(Tint, #Tints) Image.ImageColor3 = Tints[Tint] end, function() task.delay(LoopDelay, Loop) end) end task.delay(Index * StartOffset, Loop) Button.Activated:Connect(function() PlayFullscreen(Name) end) end end function TransitionTestController:Cleanup() for _, Fx in self.Cards do Fx:Destroy() end for _, Fx in self.Fullscreen do Fx:Destroy() end table.clear(self.Cards) table.clear(self.Fullscreen) end return TransitionTestController