title: I want to limit the Image button animation in specified area
body: <p>I create an ui in which the image button is animate or moved on touch. But its moving throughout the layout, I want to move it in particular set area.</p>
  
  <p>UPDATE code:</p>
  
  <p>I just clear the animation and use this on behalf. This code lets me to move the Image button on touch in specific radius but it flicker the image means the image is constantly moving around not stopping after touch.</p>
  
  <pre><code> case (MotionEvent.ACTION_MOVE):
                      x = event.getRawX();
                      y = event.getRawY();
  
                      float deltaX = x - idx;
                      float deltaY = y - idy;
                      double angleInDegrees = Math.atan(deltaY / deltaX) * 360 / Math.PI;
  
                      idx = x;
                      idy = y;
  
                      imknob.setTranslationX((float)(200*(Math.cos(angleInDegrees))));
                      imknob.setTranslationY((float)(200*(Math.sin(angleInDegrees))));
  
                      break;
  </code></pre>
  
  <p>Please if someone help me with this !</p>
  
  <p><a href="https://i.stack.imgur.com/YH6iN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YH6iN.png" alt="This is the ui of app"></a>
  The red dot image must move inside the black circle. How would I limit it!!</p>