How do I tween transparency in a linear wipe motion?

How do I tween my UIGradient Transparency to do a fade in with a linear wipe motion? Basically, I want the transparency to fade in from left to right. At the moment the whole GUI just fades in all at once.

local UIGradient = guiElement
local TValue = Instance.new("NumberValue")
TValue.Value = 1
TValue.Parent = UIGradient
TValue.Changed:Connect(function(value)
    UIGradient.Transparency = NumberSequence.new{
    NumberSequenceKeypoint.new(0, value),
    NumberSequenceKeypoint.new(1, value)}
end)
tween(TValue, {Value = 0}, 1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)


You’d have to also use tween to set a starting position and an end position for the gui part using UDIM2.New to set the position values you want.

Adding onto what admir146 said. You want to make sure the UI is properly scaled and fits off the screen. Once you make sure that the UI universally fits on all screens you want to be able to position it outside of the visible points of the screen. For example Udim2.new(0, 5, 0, 0), you can tween multiple items in one tween function. From there just tween the position to the middle of the screen.

Just tween the Offset Position. I believe it takes a vector2 so it would just be:
game:GetService(“TweenService”):Create(gradient, Tweeninfo.new(1,Enum.EasingStyle.Linear), {Offset = Vector2.new(1,0)}):Play()

1 Like

I’m not sure I understand what you mean… I’m asking if it’s possible to tween the transparency of the UI Gradient in a specific motion on a canvas group, not a drop down or slide animation that moves the GUI element across the screen.

Have you tried tweening the offset value like I suggested?

As far as I’m understanding, you want the GUI element to appear on the screen part by part, as in the transparency starts decreasing on the left side of the gui first and then slowly starts decreasing the rest of the GUIs transparency?

Yes. I didn’t realize it effected transparency as well, thanks!

Oh I apologize, I misread your post I guess.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.