javascript - How can I export a DIV to an Image -
i'd export div png or jpg image. div has appended two.js object. two.js draws svg means can't use canvas todataurl
alternatives guess.
the two.js instance 400 400px box including basic grid (horizontal & vertical lines) made using two.makeline(x1,y1,x2,y2)
.
javascript should return generated image/screenshot of div or two.js object if possible.
you can switch rendering contexts in two.js , two.js always provides reference elements creates. e.g:
var 2 = new two({ type: two.types.canvas }).appendto(document.body); var canvas = two.renderer.domelement; var dataurl = canvas.todataurl('img/png'); // though data blank because there's nothing being rendered.
Comments
Post a Comment