Advertisement
Silver1063

Synthesizer V Script

May 24th, 2021 (edited)
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getClientInfo() {
  2.     return {
  3.         "name": "Play with Smooth Page Scrolling",
  4.         "author": "Silver1063",
  5.         "versionNumber": 1,
  6.         "minEditorVersion": 65537
  7.     };
  8. }
  9.  
  10. function setInterval(t, callback) {
  11.     callback();
  12.     SV.setTimeout(t, setInterval.bind(null, t, callback));
  13. }
  14.  
  15. var playhead_position
  16. var offset
  17.  
  18. function main() {
  19.     var form = {
  20.         "title": SV.T("Playhead Properties"),
  21.         "widgets" : [
  22.             {
  23.                 "name" : "slider1",
  24.                 "type" : "Slider",
  25.                 "label" : "Playhead Position",
  26.                 "format" : "%1.2f",
  27.                 "minValue" : 0.00,
  28.                 "maxValue" : 1.00,
  29.                 "interval" : 0.01,
  30.                 "default" : 0.30
  31.             },
  32.         ]
  33.     }
  34.     var result = SV.showCustomDialog(form);
  35.     playhead_position = result.answers.slider1
  36.    
  37.     playback = SV.getPlayback()
  38.     coordinatesystem = SV.getMainEditor().getNavigation()
  39.     offset = (coordinatesystem.getTimeViewRange()[1] - coordinatesystem.getTimeViewRange()[0]) * playhead_position
  40.    
  41.     SV.getPlayback().play();
  42.     setInterval(20, scroll)
  43. }
  44.  
  45. function scroll() {
  46.     playhead_pos = SV.getProject().getTimeAxis().getBlickFromSeconds(playback.getPlayhead())
  47.  
  48.     if(SV.getPlayback().getStatus() == 'playing'){
  49.         coordinatesystem.setTimeLeft(playhead_pos - offset)
  50.     }
  51.     else {
  52.         SV.finish()
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement