3
\$\begingroup\$

I am developing a globe animation, in which the speed of the rotation changes with the length of the user's drag event.The globe when touched and moved attains positive acceleration,reaches maximum value,rotates there for sometime and starts retarding and comes back to its original position.Can anybody tell me how to do this in corona.A sample code will be really helpful.

Thanks.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Can You link to a picture of what You are trying to do? \$\endgroup\$
    – user712092
    Oct 19 '11 at 13:27
  • \$\begingroup\$ Your question is kind of unclear. Do you have content ? If so, what is your globe animation ? How many frames represent a full rotation ? Or are you asking how to do everything ? \$\endgroup\$ Nov 11 '13 at 3:27
1
\$\begingroup\$

Well first off, Corona is a 2D SDK so I'm not sure how effective it would be to do an animated globe like this. Still, it's pretty easy to get the length of a user's drag, and then you can use that length to modify the speed of your animation.

First off, make sure to set your event listeners for "touch" and not "tap". "Touch" events respond to both the beginning and end of a user's gesture, while "tap" events simply responds to the user tapping a spot.

In the documentation for "touch" event listeners, you'll see you can check the "phase" property of the event in order to check for "began" and "ended":

http://developer.anscamobile.com/content/events-and-listeners#touch_single_touch

Simply calculate the distance from start to end when event.phase=="ended"

\$\endgroup\$
0
\$\begingroup\$

I used Series of png images and changed images on swipe.The images had gradient in it hence looked like 3d rotation.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.