# HG changeset patch # User Nicholas Jillings # Date 1498596310 -3600 # Node ID 29c081e03e6be34499cb0e0277849542524ed3e7 # Parent cd1cd3358544ccebb4abe125ca710d30cfff11f4 Use requestAnimationFrame for timeline diff -r cd1cd3358544 -r 29c081e03e6b interfaces/timeline.js --- a/interfaces/timeline.js Tue Jun 27 21:11:29 2017 +0100 +++ b/interfaces/timeline.js Tue Jun 27 21:45:10 2017 +0100 @@ -441,9 +441,15 @@ }; this.startPlayback = function () { // Called when playback has begun - canvasIntervalID = window.setInterval(this.canvas.drawTicker.bind(this.canvas), 100); + var animate = function () { + this.canvas.drawTicker.call(this.canvas); + if (this.playButton.DOM.textContent == "Stop") { + window.requestAnimationFrame(animate); + } + }.bind(this); this.playButton.DOM.textContent = "Stop"; interfaceContext.commentBoxes.highlightById(audioObject.id); + canvasIntervalID = window.requestAnimationFrame(animate); }; this.stopPlayback = function () { // Called when playback has stopped. This gets called even if playback never started!