Skip to content

Instantly share code, notes, and snippets.

@hushin
Created May 6, 2013 02:20
Show Gist options
  • Save hushin/5523044 to your computer and use it in GitHub Desktop.
Save hushin/5523044 to your computer and use it in GitHub Desktop.
xjsfl.init(this); // init xJSFL
;(function(){
function scriptFolderURI() {
return fl.scriptURI.replace(/[¥/][^¥/]*?$/,"/");
}
// use Lo-Dash
fl.runScript(scriptFolderURI() + "jsload/lib/lodash.compat.js");
})();
function benchmark(name, times, callback){
var timer = new Timer(name);
timer.start();
for (var i=0; i < times; i++){
callback();
}
timer.stop(true);
}
function deleteAllLayers() {
function layerCallback(layer, index) {
$timeline.deleteLayer(index)
}
Iterators.layers(Context.create(), layerCallback);
}
clear();
benchmark("convert keyframes", 10,function(){
// task
$timeline.convertToKeyframes(0,100);
deleteAllLayers();
});
benchmark("insert keyframes", 10,function(){
// task
_.range(100).map(function(item){$timeline.insertKeyframe(item);});
deleteAllLayers();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment