, .
pastLocation.y = self.center.y - currentLocation.y;
pastLocation.y = self.center.y - pastLocation.y;
, Cam, :
override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) {
var touch: UITouch = touches.first as! UITouch
var currentTouch = touch.locationInView(self.view)
var previousTouch = touch.previousLocationInView(self.view)
currentTouch.x = currentTouch.x - self.view.center.x
currentTouch.y = self.view.center.y - currentTouch.y
previousTouch.x = previousTouch.x - self.view.center.x
previousTouch.y = self.view.center.y - previousTouch.y
var angle = atan2(previousTouch.y, previousTouch.x) - atan2(currentTouch.y, currentTouch.x)
UIView.animateWithDuration(0.1, animations: { () -> Void in
bigCircleView?.transform = CGAffineTransformRotate(bigCircleView!.transform, angle)
})
}
source
share