swift - Draw a circular SKSpriteNode with texture? -


is there way draw circular skspritenode texture? or alternatively, draw skshapenode texture?

it consider images rectangle/squares. see round, how show colored pixels: outside circle, transparent , inside, colored part.

  1. we need circle
  2. we texture it
  3. we add scene
  4. we take new texture shape node added scene
  5. we make new sprite using new texture
  6. we add sprite scene

    let shape: skshapenode = skshapenode(circleofradius: 50) shape.name = "shape" shape.linewidth = 1 // way see circle shape.fillcolor = .white // see true colors of our image //shape.strokecolor = .white //shape.glowwidth = 0 shape.filltexture = sktexture(imagenamed:"myimage") shape.position = cgpoint(x: 0, y:200) self.addchild(shape)  let newtexture: sktexture = (self.view?.texture(from: self.childnode(withname: "shape")!))! let sprite: skspritenode = skspritenode(texture: newtexture) self.addchild(sprite)   shape.removefromparent() 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -