I created a custom view to load an image of a small ball. So that the ONDA method should look like this:
Public waste panna (canvas canvas) {canvas.drawBitmap (...); } Later, I added a tooth listener so that the ball could be dragged around.
Public Boolean On Touch Event (Motion Event Event) {In Event Event = Event. Gate action (); Int x = (int) event.getX (); Int Y = (int) event.getY (); Switch (Eventation) {Case Motion Aven. Action_ MOVE: // Drag the touch with the ball / place balls as finger balls. STS (X-25); Ball.setY (wi-25); break; } // canvas cancel redraw; (); Back true; } Now, I am trying to move the ball with the curve and if it does not move beyond a certain point, then swing it back to its original place. Therefore there are currently two problems:
- Fixing the movement path of the ball
- Bringing it back by animating it is a problem I see, if I use the
ball.startAnimation, and if the ball is out of a little focus, then the ball appears cut off.
Any suggestions please? Curve appears to be part of a division, it suggests that there is a center and a radius in it.
I suggest determining what it is, and then writing a function, given the position of the finger, where the curve should be on the ball, it is the angle of the finger compared to the center of the circle , And then using this angle requires the movement of the ball correctly using the original trigonometry.
In your picture, for example, the ball is at 0 degrees and the mark is visible at approximately 20 degrees.
You can then determine that the ball should be reverted to the edge from a certain point to the finger (again, described by an angle from the center of the circle)
Comments
Post a Comment