【发布时间】:2020-03-14 06:52:45
【问题描述】:
我在图形编辑器中做了一个简单的动画,总共有四个图像。当我导出图像时,它们最终变成了一个 png。不知道为什么我不只是得到四个单独的图像——那些会很容易使用。无论如何,我如何循环动画的多合一图像?或者如何将图像分离为单独的 png 文件?
如果它们是分开的,我会这样做:
let textureAtlas = SKTextureAtlas(named: "Character")
for item in 1...textureAtlas.textureNames.count {
let texturenames = "character" + String(item)
characterTexture.append(textureAtlas.textureNamed(texturenames))
}
characterSpriteNode.run(SKAction.repeatForever(SKAction.animate(with: characterTexture, timePerFrame: 0.5)))
【问题讨论】:
-
参考这个:raywenderlich.com/…
-
谢谢,我去看看!
标签: swift animation skaction sktextureatlas