0

new here. I'm kind of stuck. I have an ImageView that I need to find out the current angle. And then do something based on that angle. Like:

if (angle >= 180 && angle <=50){ 
   do this 
} 

Any ideas?

craigcaulfield
  • 3,381
  • 10
  • 32
  • 40
  • By "current angle" do you mean the angle of rotation of the entire image? If so, maybe something like [Imageview.getRotate()](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/image/ImageView.html)? – chickity china chinese chicken May 23 '18 at 00:35
  • Yes. So the image view is a circle with options. so if you move it between 0 - 90 degrees, it will select that option, 91 - 180, next option and so on. There is a small arrow on top pointing down that shows your selection. so if the item in 3rd quarter of the circle is up top, then it should be between 180 - 270. – Mario Fernando Martinez Canek May 23 '18 at 02:10
  • Ok, did you try [Imageview.getRotate()](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/image/ImageView.html)? It seems it may work based on your description. – chickity china chinese chicken May 23 '18 at 18:09
  • hate to be a newb but i kind of actually dont understand how it works. i tried it but dont get that option on android studio – Mario Fernando Martinez Canek May 23 '18 at 23:50
  • I'm sorry, my mistake, I didn't know you were working with Android, I thought you meant the JavaFX API. I'll update if I find anything for android, again sorry I misunderstood. – chickity china chinese chicken May 24 '18 at 00:13
  • Oh ok yeah my bad i was not specific. thank you for the help though i greatly appreciate it – Mario Fernando Martinez Canek May 24 '18 at 00:16
  • There may be other similar questions on here, maybe they can help? [Android ImageView: How can I get the current rotation angle?](https://stackoverflow.com/questions/9755088/android-imageview-how-can-i-get-the-current-rotation-angle), [Rotating an image, and displaying angle of rotation](https://stackoverflow.com/questions/11287737/rotating-an-image-and-displaying-angle-of-rotation), and some others [Search android imageview get rotation angle](https://stackoverflow.com/search?q=android+imageview+get+rotation+angle). Are any of those helpful? – chickity china chinese chicken May 24 '18 at 00:25
  • These all seem to be using an animation. I am not using an animation, im using an on touch listener for the imageview so it scrolls with my finger as i swipe up or down. I see that they say to get the previous rotation angle in a variable, but i can not seem to do that. – Mario Fernando Martinez Canek May 24 '18 at 11:13

0 Answers0