Go to this website .
Open up the console and write:
`
var canvas = $("#mandelbox-canvas")[0];
var imgData = canvas.toDataURL("image/png").split(',')[1];
console.log(imgData);
Why is the image blank? How can I fix this?
Things I have already tried:
I have tried the solution to this question . IE This code:
var canvas = $("#mandelbox-canvas")[0];
canvas.getContext('webgl',{preserveDrawingBuffer:true});
var imgData = canvas.toDataURL("image/png").split(',')[1];
console.log(imgData)
however the image is still blank. The image does not contain the image displayed on the canvas.
So after much trawling through StackOverflow I found the function drawScene()
which (somehow?) force toDataURL()
to return the image data as required:
var canvas = $("#mandelbox-canvas")[0];
drawScene()
var imgData = canvas.toDataURL("image/png").split(',')[1];
console.log(imgData)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.