Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local part = Instance.new("Part")
- part.Parent = workspace
- part.Anchored = true
- local function inOutElastic(t, b, c, d, a, p)
- if t == 0 then return b end
- t = t / d * 2
- if t == 2 then return b + c end
- if not p then p = d * (0.3 * 1.5) end
- if not a then a = 0 end
- if not a or a < math.abs(c) then
- a = c
- s = p / 4
- else
- s = p / (2 * math.pi) * math.asin(c / a)
- end
- if t < 1 then
- t = t - 1
- return -0.5 * (a * math.pow(2, 10 * t) * math.sin((t * d - s) * (2 * math.pi) / p)) + b
- else
- t = t - 1
- return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * math.pi) / p ) * 0.5 + c + b
- end
- end
- local function inOutQuad(t, b, c, d)
- t = t / d * 2
- if t < 1 then
- return c / 2 * math.pow(t, 2) + b
- else
- return -c / 2 * ((t - 1) * (t - 3) - 1) + b
- end
- end
- beginVal = 0
- endVal = 1
- change = endVal - beginVal
- duration = 1
- wait(5)
- for i = 0, 1, .01 do
- wait()
- local x = inOutElastic(duration * i, beginVal, change, duration, 1, 1)
- print (x)
- part.CFrame = part.CFrame:Lerp(CFrame.new (10, 10, 10), x)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement