Hey Developers!
I’m creating an intro and one of the effects I’m trying to pursue is a smooth transparency effect fading in and out. and I was wondering how I can achieve an effect like it.
example:
Hey Developers!
I’m creating an intro and one of the effects I’m trying to pursue is a smooth transparency effect fading in and out. and I was wondering how I can achieve an effect like it.
example:
local Info = TweenInfo.new(1)
local Tween = game:GetService("TweenService"):Create(GUI,Info,{TextTransparency=1})
Tween:Play()
wow i was about to make one for him
Holy smokes man I was going to answer
local Text = --location
while true do
wait(0.1)
Text.Transparency = Tex.Transparency - 0.1
end
I don’t think a while loop is the right choice for text transparency effects, as theres no point for it to constantly run once it hits 0 + it will yield the thread. A for loop or tween service would be better.
lol uh yes i agree with you ee
You would use TweenService
for this. TweenService:Create()
takes TweenInfo
which overrides the properties of a new Tween
. These properties are explained here: TweenInfo
The example you gave is probably something like this:
local Label = script.Parent
local Info = TweenInfo.new(
0.35,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
-1,
true
)
game:GetService('TweenService'):Create(Label, Info, {
TextTransparency = 0.6
}):Play()
Try this to make a smoothly flashing text transparency.
local gui = script.Parent
local runService = game:GetService("RunService")
local speed = 1
runService.Heartbeat:Connect(function()
gui.TextTransparency = math.abs(math.sin(tick()*speed))
end)
You can make the flashing faster based off of how high the speed is. 1 is a pretty good start point.