Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions Utilities/SmoothScrollPlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
function getClientInfo() {
return {
"name": "Play with Smooth Page Scrolling",
"author": "Silver1063",
"versionNumber": 1,
"minEditorVersion": 65537
};
}

function setInterval(t, callback) {
callback();
SV.setTimeout(t, setInterval.bind(null, t, callback));
}

var playhead_position
var offset

function main() {
var form = {
"title": SV.T("Playhead Properties"),
"widgets" : [
{
"name" : "slider1",
"type" : "Slider",
"label" : "Playhead Position",
"format" : "%1.2f",
"minValue" : 0.00,
"maxValue" : 1.00,
"interval" : 0.01,
"default" : 0.30
},
]
}
var result = SV.showCustomDialog(form);
playhead_position = result.answers.slider1

playback = SV.getPlayback()
coordinatesystem = SV.getMainEditor().getNavigation()
offset = (coordinatesystem.getTimeViewRange()[1] - coordinatesystem.getTimeViewRange()[0]) * playhead_position

SV.getPlayback().play();
setInterval(20, scroll)
}

function scroll() {
playhead_pos = SV.getProject().getTimeAxis().getBlickFromSeconds(playback.getPlayhead())

if(SV.getPlayback().getStatus() == 'playing'){
coordinatesystem.setTimeLeft(playhead_pos - offset)
}
else {
SV.finish()
}
}