ios - My CALayer transform holds after animation, but the perspective disappears -
i have following code rotates calayer -45degrees on y axis:
#define d2r(x) (x * (m_pi/180.0)) - (void) swipe:(uiswipegesturerecognizer *)recognizer { catransform3d transform = catransform3dmakerotation(d2r(-45), 0, 1.0, 0); transform.m34 = -1.0 / 850; cabasicanimation *transformanimation = [cabasicanimation animationwithkeypath: @"transform"]; transformanimation.fillmode = kcafillmodeforwards; transformanimation.removedoncompletion = no; transformanimation.tovalue = [nsvalue valuewithcatransform3d:transform]; transformanimation.duration = 0.5; [self.layer addanimation:transformanimation forkey:@"transform"]; }
the animation works, except ends no perspective - ignoring m34 setting if i'm understanding things correctly.
halfway through:
at end:
what doing wrong?
animation affects appearance of view during animation. doesn't applied view after animation ends. need yourself. i'm guessing right after adding animation work:
self.layer.transform = transform;
you can right away, animation hide until animation completes.
Comments
Post a Comment