Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @objc private func stopButtonLongPressed() {
- if longPressGestureRecognizer.state == .began {
- stopButton.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
- let newTransform = (view.frame.size.height / stopButton.frame.size.height) * 4
- UIView.animate(withDuration: 2.5, delay: 0.0, options: .curveEaseInOut, animations: {
- self.stopButton.transform = CGAffineTransform(scaleX: newTransform , y: newTransform)
- }, completion: { finished in
- if finished {
- self.stopSleep()
- UIView.animate(withDuration: 1.0, animations: {
- self.stopButton.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
- })
- }
- })
- }
- if longPressGestureRecognizer.state == .ended {
- let currentLayer = stopButton.layer.presentation()
- let currentTransform = currentLayer!.transform
- stopButton.layer.removeAllAnimations()
- stopButton.layer.transform = currentTransform
- UIView.animate(withDuration: 0.3, animations: {
- self.stopButton.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement