如何在Lua中像CSS那样重复一个图像?

https://gyazo.com/d0d0bab65c0a7060972988a5e73c7959

通过以下方式实现:

local x = script.Parent.Smile
local y = script.Parent.Smile2

while true do

    x:TweenPosition(UDim2.new(0, 0, 1, 0))
    y:TweenPosition(UDim2.new(0, 0, 1, 0))
wait(.1)
    x.Position = y.Position + UDim2.new(0, 0, -1, 0)
    y.Position = UDim2.new(0, 0, 0, 0)

end

我想知道是否有更好的方法来做到这一点并使其更流畅(更慢)?

点赞
用户10399217
用户10399217

如果你想要看起来无限下落的效果,请尝试在你的缓动效果中添加一个 "Linear" 参数。这将保持缓动的恒定速度。例如:

local x = script.Parent.Smile
local y = script.Parent.Smile2

while true do

    x:TweenPosition(UDim2.new(0, 0, 1, 0),"Out","Linear",0.1)
    y:TweenPosition(UDim2.new(0, 0, 1, 0),"Out","Linear",0.1)
wait(.105) -- 确保在 0.1 秒后再次进行缓动,0.105 安全地账户游戏中的任何延迟
    x.Position = y.Position + UDim2.new(0, 0, -1, 0)
    y.Position = UDim2.new(0, 0, 0, 0)

end

尝试使用上面的脚本,如果不行,你可以责怪我。

2018-09-22 02:13:23