Created
February 19, 2013 23:15
-
-
Save danfinlay/4991144 to your computer and use it in GitHub Desktop.
My playback method for voxel-recorder kinda sucks, and doesn't handle looping. Any better ideas than this?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i=0; i<recording.length; i++){ | |
var time = Math.ceil((recording[frame+i]['time']-recording[frame]['time'])/speed) | |
setTimeout(function(){ | |
frame++ | |
assumeFrame(frame) | |
if(frame===recording.length-1){ | |
if(loop){ | |
frame=0 | |
i=1 | |
}else{ | |
isPlaying=false | |
} | |
} | |
}, time) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment