I am trying to code this animation: https://drive.google.com/file/d/16rNAWB_pWJAaaDL7GdJFaKh9_yq8HoLR/view?usp=sharing
It uses a pan gesture to interact with the view and change values accordingly.
However, I am not able to figure out how to make the image “Jump” to the point where the user touches it and then make the pan gesture.
With the code added below, the image jumps to a new random position but not to where the user is touching the view.
Any idea on how I can achieve that?
rotateAnimation.fromValue = to
rotateAnimation.toValue = to
rotateAnimation.duration = duration
rotateAnimation.repeatCount = 0
rotateAnimation.isRemovedOnCompletion = false
rotateAnimation.fillMode = .forwards
rotateAnimation.timingFunction = CAMediaTimingFunction(name: .linear)
rotor.layer.add(rotateAnimation, forKey: "transform.rotation.z")
Kirti Shilwant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.