在我的场景中,我使用了三个基本的形状:正方形、圆圈和三角形。我想要创建一个自定义SKAction来动画从一种形状到另一种形状的转换。
我正在尝试重新创建类似于这 in SpriteKit的东西。
我使用UIBezierPath为每个形状生成CGPath:
//Circles
UIBezierPath(ovalInRect: CGRect)
//Squares
UIBezierPath(rect: CGRect)
//Triangles
convenience init(triangleInRect:CGRect, centered:Bool) {
self.init()
var origin = CGPointZero
if centered {
origin = CGPoint(x: -triangleInRect.width / 2, y: -triangleInRect.height / 2)
}
moveToPoint(origin)
addLineToPoint(CGPoint(x: origin.x + triangleInRect.width, y: origin.y))
addLineToPoint(CGPoint(x: origin.x + triangleInRect.width / 2, y: origin.y + triangleInRect.height))
closePath()
}发布于 2015-08-10 07:35:10
动画序列..。
还有一幅画..。

还有一个视图剪辑..。

https://stackoverflow.com/questions/31896443
复制相似问题