Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- this needs to be called "Settings" and a global to work
- Settings = {}
- -- -10 to +10 ms jitter
- Settings.Frequency = 10
- -- -15 to +15 jitter
- Settings.Amplitude = 15
- SetSettings(Settings)
- -- anything using Settings needs to use it after "SetSettings"
- for idx, action in ipairs(CurrentScript.actions) do
- -- check if action is selected
- if action.selected then
- action.pos = math.floor(action.pos + math.sin(idx*Settings.Frequency/100.0)*Settings.Amplitude)
- -- clamp position between 0 and 100
- action.pos = clamp(action.pos, 0, 100)
- end
- -- update progress bar every 100 actions
- if idx % 100 == 0 then
- -- SetProgress expects a number between 0 and 1
- SetProgress(idx / #CurrentScript.actions)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement