SKTextureというNodeに画像を付ける為のオブジェクトについて調べてみました。
SKSpriteNodeに画像を付けるだけならUIImageでもできるので、UIImageとの違いを中心に調べてみます。
SKSpriteNodeに付ける事ができる
SKSpriteNodeのtextureというプロパティーにセットして使います。
SKNodeにはセットできないようです。
UIImageは初期化時にしかセットできないので、途中で変更したい時はUIImageでなくSKTextureを使った方が良さそうです。
SKActionで使える
SKActionにはSKTextureをセットするメソッドがあります。
これはUIImageではできません。
public class func setTexture(texture: SKTexture) -> SKAction public class func setNormalTexture(texture: SKTexture) -> SKAction public class func animateWithTextures(textures: [SKTexture], timePerFrame sec: NSTimeInterval) -> SKAction public class func animateWithNormalTextures(textures: [SKTexture], timePerFrame sec: NSTimeInterval) -> SKAction