I want to tween a UIGradients color, but have no idea how to, i want it to move up and down.
Any support/devfourm link is appreciated, thanks.
I want to tween a UIGradients color, but have no idea how to, i want it to move up and down.
Any support/devfourm link is appreciated, thanks.
It’s actually really simple. You would have to use TweenService and tween the UIGradient.Offset. Here is an example of what you can do!
local object = --path to object
local gradient = object.UIGradient
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out)
local offset1 = {Offset = Vector2.new(1.1, 0)}--ending position of the gradient
local create = ts:Create(gradient, ti, offset1)
local startingPos = Vector2.new(-1.1, 0)--starting position of the gradient
local addWait = 2.5
gradient.Offset = startingPos
local function animate()
create:Play()
create.Completed:Wait()
gradient.Offset = startingPos
create:Play()
create.Completed:Wait()
gradient.Offset = startingPos
wait(addWait)
animate()
end
animate()
this is just something I use in my UI’s and its pretty nice
(If you put the gradient rotation to 45 you could get a cool shiny effect)
Example