我想要的效果就像水面上的雨滴,波浪从中心点向外辐射。
我创建了一个圆形:
let initialRadius = 4.0
let myPath: CGMutablePathRef = CGPathCreateMutable()
CGPathAddArc(myPath, nil, 0, 0, initialRadius, 0, M_PI * 2, true)
let myCircle = SKShapeNode()
myCircle.path = myPath
myCircle.position = CGPoint(x: xPos, y: yPos)
myCircle.lineWidth = 0.5
myCircle.antialiased = false
myCircle.fillColor = SKColor.orangeColor() // background is orange
myCircle.strokeColor = SKColor.whiteColor()
myCircle.physicsBody = SKPhysicsBody(edgeLoopFromPath: myPath)
然后我让精灵展开,然后淡出:
let duration: NSTimeInterval = 1.7
let fade = SKAction.fadeOutWithDuration(duration)
let scale = SKAction.scaleTo(9.0, duration: duration)
fade.timingMode = .EaseOut
scale.timingMode = .EaseOut
myCircle.runAction(fade)
myCircle.runAction(scale)
这很接近,但是当圆圈的大小正确扩大时,lineWidth 也在扩大。你能想出一种方法来做到这一点,同时保持线宽不变吗?