【问题标题】:How to repeat an image like css in lua?如何在lua中重复像css这样的图像?
【发布时间】:2018-06-08 13:51:12
【问题描述】:

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

我想知道是否有更好的方法让它更平滑(更慢)?

【问题讨论】:

    标签: lua roblox


    【解决方案1】:

    如果您希望它看起来好像无限下降,请尝试在补间中添加“线性”参数。它将保持补间的速度恒定。例如:

    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) -- making sure to tween again after 0.1 seconds, the 0.105 safely accounts for any latency in the game
        x.Position = y.Position + UDim2.new(0, 0, -1, 0)
        y.Position = UDim2.new(0, 0, 0, 0)    
    
    end
    

    试试上面那个脚本,如果不行你可以怪我

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-30
      • 1970-01-01
      • 1970-01-01
      • 2020-12-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多