Advertisement
anphu04

Moon Animation Camshaker by Konethorix

Feb 22nd, 2020
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. -- THIS IS FOR MOON ANIMATION 1, NOT 2 !! --
  2.  
  3. -- 22/2/2020: BY KONETHORIX, the lord that created the jojo poses simulator game --
  4. --== INSTRUCTIONS ==--
  5. --[[
  6. 1. place this script inside Lighting
  7. 2. while in Moon Animation 1, position your camera whatever you want, THEN MAKE SURE TO SAVE THE ANIMATION
  8. 3. open the camera folder (xSIXxAnimationSaves --> <YOUR ANIMATION> --> _cam --> Camera)
  9. 4. select the keyframe folder you want to shake (ex: select the folder "3" to start the shake from the 3rd keyframe), do not select its insides
  10. 5. edit the numbers yourself (all timing are counted in seconds)
  11. 6. Ctrl+A to copy the entire script, paste it in the COMMAND BAR, then press ENTER
  12. (if you can't find the command bar, go to VIEW tab --> Command Bar)
  13. 7. Close Moon Animation 1, then reopen it for it to reload what you just did --
  14. --]]
  15. duration = 1 -- how long the shake will be
  16. fadein = 0
  17. fadeout = 0.8
  18.  
  19. amount = 25 -- how many shakes within the whole period
  20. xAmp = 0.25 -- the max amplitude the camera can go in X axis (left and right)
  21. yAmp = 0.15 -- in Y axis (up and down)
  22. zAmp = 0 -- in Z axis (back and forward)
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. scriptName = "-= Mooncam Shaker by Konethorix =-"
  37. fps = 1/60 -- DO NOT CHANGE, moon animation 1 used this as the default fps
  38.  
  39. startFolder = game.Selection:Get()[1]
  40. camFolder = startFolder.Parent
  41. startKeyframe = startFolder.Name
  42. startTime = startFolder.frmPos.Value * fps
  43. camCf = workspace.Camera.CFrame
  44. rootModel = camFolder.Parent.Parent.Parent.Parent
  45. if rootModel:FindFirstChild("HumanoidRootPart") then
  46. reference = rootModel.HumanoidRootPart
  47. end
  48.  
  49.  
  50.  
  51.  
  52. if not game.ServerStorage:FindFirstChild("QUARANTINE") then
  53. quarantine = Instance.new("Folder")
  54. quarantine.Name = "QUARANTINE"
  55. quarantine.Parent = game.ServerStorage
  56. else
  57. quarantine = game.ServerStorage.QUARANTINE
  58. end
  59. quarantine:ClearAllChildren()
  60.  
  61. function Warn(txt)
  62. local m = Instance.new("Message", workspace)
  63. m.Name = txt
  64. m.Text = txt
  65. game.Debris:AddItem(m, #txt/10)
  66. end
  67.  
  68. if fadein + fadeout <= duration then
  69. local allKeyframes = camFolder:GetChildren()
  70. startFolder:Destroy() -- destroyed to be replaced
  71. for i = startKeyframe+1, #allKeyframes do
  72. allKeyframes[i].Name = tostring( tonumber(allKeyframes[i].Name) + (amount-1) ) -- keyframe number
  73. allKeyframes[i].frmPos.Value = math.floor(allKeyframes[i].frmPos.Value + duration/fps) -- convert time to frame pos
  74. allKeyframes[i].Parent = quarantine
  75. end
  76.  
  77.  
  78. local i = startKeyframe -- start off at the start to replace the old one
  79. local runner = 0
  80. for Time = startTime, startTime + duration, duration/amount do
  81. local envelope
  82. if Time - startTime <= fadein and fadein > 0 then
  83. envelope = Time - startTime / fadein
  84. elseif startTime + duration - Time <= fadeout and fadeout > 0 then
  85. envelope = startTime + duration - Time / fadeout
  86. else
  87. envelope = 1
  88. end
  89.  
  90. local newframe = game.Lighting[scriptName].Sample:Clone()
  91. x = math.sin(runner) * xAmp
  92. y = math.cos(runner) * yAmp
  93. z = math.sin(runner) * zAmp
  94. runner = runner + math.random(135,315)
  95. if reference == nil then
  96. newframe.cf.Value = camCf * CFrame.new(
  97. x * envelope,
  98. y * envelope,
  99. z * envelope
  100. )
  101. else
  102. newframe.cf.Value = reference.CFrame:ToObjectSpace(camCf * CFrame.new(
  103. x * envelope,
  104. y * envelope,
  105. z * envelope
  106. ))
  107. end
  108.  
  109. newframe.easeDir.Value = "In"
  110. newframe.easeSty.Value = "Linear"
  111. newframe.frmPos.Value = math.floor(Time / fps) -- convert time to frame pos
  112. newframe.weight.Value = 1
  113.  
  114. newframe.Name = tostring(i) -- keyframe number
  115. newframe.Parent = camFolder
  116. i = i + 1
  117. end
  118.  
  119. for i,oldframe in pairs(quarantine:GetChildren()) do
  120. oldframe.Parent = camFolder
  121. end
  122. else
  123. Warn("FADEIN + FADEOUT must not be larger than DURATION, hope that make sense to you")
  124. end
  125.  
  126. game.ChangeHistoryService:SetWaypoint("Mooncam Shaker")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement