我要进行捏/缩放,使缩放从当前比例开始。我尝试了以下代码:
@objc func pinchedView(recognizer:UIPinchGestureRecognizer) {
if (recognizer.state == .ended) {
lastScale = 1.0
return
}
let scale = 1.0 - (lastScale - recognizer.scale)
let zoomInAction = SKAction.scale(to: cameraNode.yScale + scale, duration: 0.25)
lastScale = recognizer.scale
cameraNode.run(zoomInAction)
}
问题在于,无论我用哪种方式捏捏,它都会变得越来越小。我该如何纠正?