Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. local part = Instance.new("Part")
  2. part.Parent = workspace
  3. part.Anchored = true
  4.  
  5. local function inOutElastic(t, b, c, d, a, p)
  6. if t == 0 then return b end
  7.  
  8. t = t / d * 2
  9.  
  10. if t == 2 then return b + c end
  11.  
  12. if not p then p = d * (0.3 * 1.5) end
  13. if not a then a = 0 end
  14.  
  15. if not a or a < math.abs(c) then
  16. a = c
  17. s = p / 4
  18. else
  19. s = p / (2 * math.pi) * math.asin(c / a)
  20. end
  21.  
  22. if t < 1 then
  23. t = t - 1
  24. return -0.5 * (a * math.pow(2, 10 * t) * math.sin((t * d - s) * (2 * math.pi) / p)) + b
  25. else
  26. t = t - 1
  27. return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * math.pi) / p ) * 0.5 + c + b
  28. end
  29. end
  30.  
  31. local function inOutQuad(t, b, c, d)
  32. t = t / d * 2
  33. if t < 1 then
  34. return c / 2 * math.pow(t, 2) + b
  35. else
  36. return -c / 2 * ((t - 1) * (t - 3) - 1) + b
  37. end
  38. end
  39.  
  40. beginVal = 0
  41. endVal = 1
  42. change = endVal - beginVal
  43. duration = 1
  44.  
  45. wait(5)
  46. for i = 0, 1, .01 do
  47. wait()
  48. local x = inOutElastic(duration * i, beginVal, change, duration, 1, 1)
  49. print (x)
  50. part.CFrame = part.CFrame:Lerp(CFrame.new (10, 10, 10), x)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement