I'm having trouble with something, I need to make an object (Pong paddle) to move only in a circular route along the screen. same thing as if you would have a constant y axis value and it would only move along the x axis as u drag ur finger on it, but to restrict it to a circular route.
any insights? I saw this thing http://www.kirupa.com/developer/mx/circular.htm
and it only helps in figuring out how to move something constantly at a circle (eventhough it's Flash, the idea is the same)
Thanks
The points on a circle can be defined by the functions:
Where (a,b) is the center of the circle.
Depending on the speed you desire, you can say that you want a full circle to happen every T seconds. And if t is the time since the animation began:
You can use these functions to create your own ViewAnimation, OpenGL function, or if you're using canvas, to set the position of the paddle during the
onDraw()
event.Here is a block of code I use to rotate an imageview by one finger.
Hope this help
Edit: Basically, what the above code does is enable user to rotate an image, and the center of the image will not change. angleBetween2Line() is to calculate the degree that finger has moved in a circle whose center is the image's center.