iphone - 3D Door Open Animation between two UIViewControllers -


this has been asked before, there no sample code found on stackoverflow , no proper solutions far i'm aware. have solution, looks crap. i'd grateful input , modifications more realistic 3d door open / book cover animation.

aim have animation between uiviewcontrollers effect if opening door or book cover. viewcontroller 2 static , in background. above place viewcontroller 1 covers viewcontroller 2. animation open viewcontroller 1 (like hardcover book) , reveal viewcontroller 2 (your first page say, or whatever behind door).

first thing note can't uinavigationcontroller difficult overwrite custom animations. proper tutorial on how set our 2 viewcontrollers can found here: viewcontroller animations

so once setup, here custom animation looks crap. looks if squeezing door / cover of book left. there no 3d feel it, i'm afraid. suggestions of how make better welcome:

-(void)opendoorto:(uiviewcontroller *)acontroller duration:(float)aduration {       [acontroller viewwillappear:yes];     [activecontroller viewwilldisappear:yes];      [self.view insertsubview:acontroller.view belowsubview:activecontroller.view]; // below activecontroller      [acontroller viewdidappear:yes];      [uiview beginanimations:nil context:nil];     [uiview setanimationduration:aduration];      acontroller.view.transform = cgaffinetransformmaketranslation(0,0);      catransform3d _3dt = catransform3didentity;     _3dt = catransform3dtranslate(_3dt, -320, 0, 0);     _3dt = catransform3drotate(_3dt, m_pi * 1.5, 0.0, 1, 0.0);     _3dt = catransform3dtranslate(_3dt, 320, 0, 0);      activecontroller.view.layer.transform = _3dt;      [uiview commitanimations];      [self performselector:@selector(animationdone:) withobject:acontroller afterdelay:aduration];   } 

i think main problem don't know how handle catransform3dtranslate , catransform3drotate.

here posts on this, can't see how apply them 3d door opener:

3d door - axis in middle

3d unfolding

you have apply little trick 3d work:

catransform3d _3dt = catransform3didentity; _3dt.m34 = 1.0 / -1000; 

this creates perspective transform. 1000 represents distance viewer objects (you can experiment value smooth look).


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -