d13 Posted May 27, 2014 Share Posted May 27, 2014 Hello! Can anyone suggest a simple way to convert a sprite texture to an ordinary JavaScript Image object? Quote Link to comment Share on other sites More sharing options...
xerver Posted May 28, 2014 Share Posted May 28, 2014 > a simple way Nope. But you can draw a texture to a canvas, then convert that to a dataUrl, then use that in the src of an image object. d13 1 Quote Link to comment Share on other sites More sharing options...
d13 Posted May 28, 2014 Author Share Posted May 28, 2014 That should work fine, thank you Xerver. Quote Link to comment Share on other sites More sharing options...
agamemnus Posted September 16, 2014 Share Posted September 16, 2014 How do we actually draw to canvas -- what is the best way? Quote Link to comment Share on other sites More sharing options...
xerver Posted September 16, 2014 Share Posted September 16, 2014 This is how a sprite renders itself: renderSession.context.drawImage( this.texture.baseTexture.source, this.texture.crop.x, this.texture.crop.y, this.texture.crop.width, this.texture.crop.height, dx, dy, this.texture.crop.width, this.texture.crop.height); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.