Copy NodeElement Image Data to a new Sprite

Copy NodeElement Image Data to a new Sprite
0.0 0

#1

Hello!

I’m getting stucked when tring to make a new Sprite with NodeElement Image Data

Anyone knows if there exist something like:

`var sprite = new cc.Sprite(layer.getImageData())`

Thx!


#2

I Made it!
You can take a picture to the canvas DOM element!

var photo = cc.game.canvas.toDataURL("image/png");
cc.loader.loadImg(photo, {isCrossOrigin : false },
  function(err, img){
    // you can use img var to make the sprite
  }
 )