开发者

Best way to animate a spinning wheel thats responsive to touch events

I need guidance towards the right direction to take here. I want to build a spinning wheel control where a user can select an element.

I want to accomplish the following:

  1. Receive touch events that will rotate the wheel based on the finger position in touchesMoved
  2. Magnify the image that is inside the selected image indicator when it passes through.

I was thinking of a开发者_C百科 core animation Basic Animation and animating the rotation. Using an animation group and rotate it around.

Problem 1: How do I sync the animation to the touch events.

Problem 2: How will I know which image is the one I need to magnify with for example an CGAffineTransformMakeScale.

Is there a best practice for my problem. Esp. with performance in mind?

http://img24.imageshack.us/img24/8596/imagezy.png


You can achieve this by update the wheel for every touchmoved event.

For each touchmoved, touchbegin event, you can know the angle of the line from center of the wheel to your finger. You save your begin angle, then you will know the diff angle. The wheel can rotate depends on your finger by using angle.

you can enlarge the image icon by either of these two ways. 1. You can know which image icon angle in all the wheel, and you also know current angle of the wheel. So, if the image icon is between the right angle. Ex. if wheel is at 45 degree, then icon at -45 or 360-45 degree will be enlarged. 2. check the y origin of each image icon, if the image icon origin y is above threshold.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜