Hello everyone,
I am currently in the process of creating a matrix display for trains and buses. My idea was to use a ServerScript in the workspace and the TweenService to animate the position and the AnchorPoint of the text.
Here is my code for the animation:
local text = script.Parent.TextLabel
local TweenService = game:GetService("TweenService")
local info1 = TweenInfo.new(text.AbsoluteSize.X / 175,Enum.EasingStyle.Linear)
local info2 = TweenInfo.new(text.AbsoluteSize.X / 400,Enum.EasingStyle.Linear)
local position1 = UDim2.new(0,0,0,0)
local positionOrigin = UDim2.new(1,0,0,0)
local anchorpoint1 = Vector2.new(1,0)
local anchorpointOrigin = Vector2.new(0,0)
while true do
text.Position = positionOrigin
text.AnchorPoint = anchorpointOrigin
wait(1)
local tween1 = TweenService:Create(text,info2,{Position = position1})
tween1:Play()
tween1.Completed:Wait()
local tween2 = TweenService:Create(text,info1,{AnchorPoint = anchorpoint1})
tween2:Play()
tween2.Completed:Wait()
end
However, I have no idea how to do this so that the speed (time) always remains the same, no matter how large “x” is. In the code I had tried to solve it with the AbsoluteSize, but this doesn’t really work (see video → initially too fast (tween1) then normal (tween2)).
Is there another way to set the speed (time) so that it stays the same no matter how long the text is or is there a better and more efficient way to bridge this?