Created
June 18, 2018 22:28
-
-
Save 4lberto/aea528f080037e3bd55666d91b1efbe8 to your computer and use it in GitHub Desktop.
gets an html5 canvas and writes one image per frame. First version
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
var page = require('webpage').create(); | |
page.onConsoleMessage = function(msg, lineNum, sourceId) { | |
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")'); | |
}; | |
console.log("Antes de llamara a la carga") | |
page.onCallback = function(data){ | |
console.log("llamda a onCallBack a través de window número "+data) | |
success=page.render("example_"+data+".png") | |
//success = true | |
console.log("Render example_"+data+".png ok?" + success) | |
//page.render("example_"+cont+".png") | |
}; | |
page.open('http://localhost:8000/Plantilla1.html', function(status) { | |
console.log("Status: " + status); | |
if(status === "success") { | |
var ua = page.evaluate(function(page) { | |
var cont = 1 | |
createjs.Ticker.addEventListener("tick", handleTick); | |
function handleTick(event) { | |
cont++ | |
//console.log("Writing 'example_"+cont+".png'") | |
window.callPhantom(cont); | |
// Actions carried out each tick (aka frame) | |
if (!event.paused) { | |
// Actions carried out when the Ticker is not paused. | |
} | |
} | |
}, page); | |
console.log("Llamando a render example.png") | |
page.render('example.png'); | |
} | |
console.log("Salida Desactivada!") | |
//phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment