SKAction.resize 无效
SKAction.resize doesn't work
我想在节点移动时使用 SKAction 调整 SKShapeNode 的大小(使用另一个 SKAction),但没有成功。我只尝试调整大小,但也失败了(什么也没发生)。
我就是这么做的:
background.run(SKAction.resize(toWidth: winFrame.width/20, height: winFrame.height/20, duration: 0.5))
background.run(SKAction.move(to: CGPoint(x: winFrame.width*0.97 / -2, y: -1*(winFrame.height/7) * 1.5), duration: 0.5))
我能做什么?
我想你应该试试打电话:
SKAction.scale(by: CGFloat, duration: TimeInterval)
而不是调整节点大小
如果你阅读文档,它说 .resize
仅适用于 SKSpriteNodes。
This action can only be executed by an SKSpriteNode object. When the
action executes, the sprite’s size property animates to its new value.
This action is not reversible; the reverse of this action has the same
duration but does not change anything.
https://developer.apple.com/documentation/spritekit/skaction/1417724-resize
我想在节点移动时使用 SKAction 调整 SKShapeNode 的大小(使用另一个 SKAction),但没有成功。我只尝试调整大小,但也失败了(什么也没发生)。 我就是这么做的:
background.run(SKAction.resize(toWidth: winFrame.width/20, height: winFrame.height/20, duration: 0.5))
background.run(SKAction.move(to: CGPoint(x: winFrame.width*0.97 / -2, y: -1*(winFrame.height/7) * 1.5), duration: 0.5))
我能做什么?
我想你应该试试打电话:
SKAction.scale(by: CGFloat, duration: TimeInterval)
而不是调整节点大小
如果你阅读文档,它说 .resize
仅适用于 SKSpriteNodes。
This action can only be executed by an SKSpriteNode object. When the action executes, the sprite’s size property animates to its new value.
This action is not reversible; the reverse of this action has the same duration but does not change anything.
https://developer.apple.com/documentation/spritekit/skaction/1417724-resize