Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- THIS IS FOR MOON ANIMATION 1, NOT 2 !! --
- -- 22/2/2020: BY KONETHORIX, the lord that created the jojo poses simulator game --
- --== INSTRUCTIONS ==--
- --[[
- 1. place this script inside Lighting
- 2. while in Moon Animation 1, position your camera whatever you want, THEN MAKE SURE TO SAVE THE ANIMATION
- 3. open the camera folder (xSIXxAnimationSaves --> <YOUR ANIMATION> --> _cam --> Camera)
- 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
- 5. edit the numbers yourself (all timing are counted in seconds)
- 6. Ctrl+A to copy the entire script, paste it in the COMMAND BAR, then press ENTER
- (if you can't find the command bar, go to VIEW tab --> Command Bar)
- 7. Close Moon Animation 1, then reopen it for it to reload what you just did --
- --]]
- duration = 1 -- how long the shake will be
- fadein = 0
- fadeout = 0.8
- amount = 25 -- how many shakes within the whole period
- xAmp = 0.25 -- the max amplitude the camera can go in X axis (left and right)
- yAmp = 0.15 -- in Y axis (up and down)
- zAmp = 0 -- in Z axis (back and forward)
- scriptName = "-= Mooncam Shaker by Konethorix =-"
- fps = 1/60 -- DO NOT CHANGE, moon animation 1 used this as the default fps
- startFolder = game.Selection:Get()[1]
- camFolder = startFolder.Parent
- startKeyframe = startFolder.Name
- startTime = startFolder.frmPos.Value * fps
- camCf = workspace.Camera.CFrame
- rootModel = camFolder.Parent.Parent.Parent.Parent
- if rootModel:FindFirstChild("HumanoidRootPart") then
- reference = rootModel.HumanoidRootPart
- end
- if not game.ServerStorage:FindFirstChild("QUARANTINE") then
- quarantine = Instance.new("Folder")
- quarantine.Name = "QUARANTINE"
- quarantine.Parent = game.ServerStorage
- else
- quarantine = game.ServerStorage.QUARANTINE
- end
- quarantine:ClearAllChildren()
- function Warn(txt)
- local m = Instance.new("Message", workspace)
- m.Name = txt
- m.Text = txt
- game.Debris:AddItem(m, #txt/10)
- end
- if fadein + fadeout <= duration then
- local allKeyframes = camFolder:GetChildren()
- startFolder:Destroy() -- destroyed to be replaced
- for i = startKeyframe+1, #allKeyframes do
- allKeyframes[i].Name = tostring( tonumber(allKeyframes[i].Name) + (amount-1) ) -- keyframe number
- allKeyframes[i].frmPos.Value = math.floor(allKeyframes[i].frmPos.Value + duration/fps) -- convert time to frame pos
- allKeyframes[i].Parent = quarantine
- end
- local i = startKeyframe -- start off at the start to replace the old one
- local runner = 0
- for Time = startTime, startTime + duration, duration/amount do
- local envelope
- if Time - startTime <= fadein and fadein > 0 then
- envelope = Time - startTime / fadein
- elseif startTime + duration - Time <= fadeout and fadeout > 0 then
- envelope = startTime + duration - Time / fadeout
- else
- envelope = 1
- end
- local newframe = game.Lighting[scriptName].Sample:Clone()
- x = math.sin(runner) * xAmp
- y = math.cos(runner) * yAmp
- z = math.sin(runner) * zAmp
- runner = runner + math.random(135,315)
- if reference == nil then
- newframe.cf.Value = camCf * CFrame.new(
- x * envelope,
- y * envelope,
- z * envelope
- )
- else
- newframe.cf.Value = reference.CFrame:ToObjectSpace(camCf * CFrame.new(
- x * envelope,
- y * envelope,
- z * envelope
- ))
- end
- newframe.easeDir.Value = "In"
- newframe.easeSty.Value = "Linear"
- newframe.frmPos.Value = math.floor(Time / fps) -- convert time to frame pos
- newframe.weight.Value = 1
- newframe.Name = tostring(i) -- keyframe number
- newframe.Parent = camFolder
- i = i + 1
- end
- for i,oldframe in pairs(quarantine:GetChildren()) do
- oldframe.Parent = camFolder
- end
- else
- Warn("FADEIN + FADEOUT must not be larger than DURATION, hope that make sense to you")
- end
- game.ChangeHistoryService:SetWaypoint("Mooncam Shaker")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement