0

In my app I have say a big Star "Sun" in center and small planets around it.

With animation how can i shift planet (scroll) around big Star "Sun" with touch.

So when say Planet A scrolls to right then its position will take Planet B, which is on its left and Planet A becomes bit smaller in size and Planet B becomes bit bigger (to show near and far effect).

It keeps on revolving around Star "Sun".

Any suggestion will be highly appreciated.

Thanks

Mann
  • 5,477
  • 6
  • 45
  • 57
  • Mate to be frank i am fairly new to Animation. I have done scrolling effects of cards in other game in that cards flips. But this is new concept and i dont know how can i achieve it. – Mann May 24 '12 at 09:56
  • 2
    first try to know about [types of animations used](http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/CoreAnimation_Cookbook/Introduction/Introduction.html#//apple_ref/doc/uid/TP40005406) in Objective c – Charan May 24 '12 at 10:00
  • 1
    You can also look at the [Core Animation Programming Guide](http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/WhatisCoreAn…). Once you've got the basics. You should look at transforms and perspective, that will help you achieve the 3D effect you are looking for. You should probably take a closer look at the section about [Layer Geometry and Transforms](http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Layers.html#//apple_ref/doc/uid/TP40006082-SW1) – David Rönnqvist May 24 '12 at 10:02

1 Answers1

1

The easiest way to do this would be to put all your planet image views on a transparent container view that is centered over the sun view. Lets call this invisible view the orbitView. Then put a rotation gesture recognizer on the orbitView. If you rotate the orbitView around it's Z axis, all the planet views should rotate around the center of the orbitView, giving you the effect you want.

EDIT: Rereading your post, it sounds like you might want the planets to orbit in 3D, as if you are "in the plane of the ecliptic", looking edge-on onto their orbits. That effect is more complicated and I'd have to think about it a little bit.

Duncan C
  • 128,072
  • 22
  • 173
  • 272