ios - Set layer.transform with CATransform3DRotate like UIViewAnimationOptionTransitionFlipFromRight -
i've set view such when app navigates forward, performs transitionfromview using uiviewanimationoptiontransitionflipfromright option. yields effect like:

navigating backwards uses uiviewanimationoptiontransitionflipfromleft, otherwise same. ok, far, good.
now, i've set uipangesturerecognizer can link flipping of views user's horizontal gesture on screen. can't use transitionfromview in case, gesture recognizer manually setting transform property of layer with:
catransform3d transform = catransform3didentity; transform.m34 = 1.0 / -800.0; viewtotransform.layer.transform = catransform3drotate(transform, m_pi * rotationpercent, 0.0, 1.0, 0.0); but yielding subtly different effect:

in uiviewanimationoptiontransitionflipfromright option of transitionfromview view scaled during flipping animation such tallest edge of flipped view stays height of container view. when manually doing transform of layer, it's center of view stays constant size, cropping corners of longer edge of flipped view during animation.
how achieve effect when setting transform property of layer in gesture recognizer (i want adjust opacity, too, slight dimming effect transitionfromview achieves). i'm thinking use catransform3dmakescale , manually calculate scaling function based upon angle of rotation , particular m34 setting, before go through exercise, want make sure i'm not overlooking more intuitive or natural way achieve simultaneous scaling , rotating standard flip animation entails. , if have calculate scaling factor manually, i'd appreciate guidance how define function of m34 setting , angle (i'm no expert in subtleties of vector transformations).
the transforms based around layers anchorpoint. "pivot point" around rotate.
the anchorpoint uses scale 0 1 in both x , y , defaults 0.5, 0.5
i believe want anchor layer set this:
viewtotransform.layer.anchorpoint = cgpointmake(0.5, 1); there info , research locations in answers question:
Comments
Post a Comment