Got a faster result, to where the second half of it isn’t as slow (due to the Y value starting at the very bottom and the X value being 0, it had to climb all the way up)
And came up with this weird result with TweenService and altering some variables:
New code here:
local TweenService = game:GetService("TweenService")
local HUD = script.Parent
local Amount = 12
local Sizing = math.ceil(HUD.AbsoluteSize.X / Amount)
local PreviousTile = nil
local Count = 0
local XStart = 0
task.wait(3) -- so I can watch the effect
local function NewInstance(Instance,Parent,Name,Properties)
local i = Instance.new(Instance)
if Name then
i.Name = Name
end
if Properties then
for p,v in pairs(Properties) do
i[p]=v
end
end
if Parent then
i.Parent = Parent
end
return i
end
local function CreateTile(x,y,i)
local Tile = NewInstance("Frame",HUD.Main,"Tile"..i,{
BorderSizePixel = 0,
BackgroundColor3 = (i%2==0 and Color3.fromRGB(240,240,240) or Color3.fromRGB(0,0,0)),
Position = UDim2.new(0,Sizing*x,0,Sizing*y),
Size = UDim2.new(0,0,0,0),
})
TweenService:Create(Tile,TweenInfo.new(0.6,Enum.EasingStyle.Back,Enum.EasingDirection.In),{
Size = UDim2.new(0,Sizing,0,Sizing)
}):Play()
return Tile
end
local function CreateDiagonal(Y)
PreviousTile = CreateTile(XStart,Y,Y)
for i = XStart,Amount do
PreviousTile = CreateTile(i,Y-i,Y)
if PreviousTile.Position.Y.Offset == 0 then
break
end
if PreviousTile.Position.Y.Offset >= Amount * Sizing then
XStart += 1
end
task.wait(0.015)
end
end
local function PlayTransition()
PreviousTile = CreateTile(0,0,0)
for i = 1,20 do
CreateDiagonal(i)
task.wait(0.015)
end
end
PlayTransition()
print("Completed")