ios - Exaggerate perspective on a CATransform3DPerspective -
i have animation i'm adding view. in animation, have cell collapses if it's beingness folded. split view 2 separate layers , apply rotation on each layer. working, however, effect more subtle i'd like. i'm looking way increment gap between ends of centerline (top , bottom edges of each layer) extends in during animation. basically, halves aren't tall plenty convincingly they're folding backwards. here have mid animation, orange lines approximately want lines fall during animation:
here code handling rotation:
- (cabasicanimation *)foldlayertovalue:(cgfloat)tovalue expanding:(bool)expanding { cabasicanimation *animation = [cabasicanimation animationwithkeypath:@"transform"]; catransform3d rotate = catransform3didentity; rotate.m34 = 1.0 / -2000.f; rotate = catransform3drotate(rotateandscale, [self radiansfromdegrees:tovalue], 1.f, 0.f, 0.f); animation.tovalue = [nsvalue valuewithcatransform3d:rotateandscale]; homecoming animation; } this gets added catransaction moves lower section downwards right amount during animation. tried adding scale factor animation, has impact on entire layer, scaling both top , bottom edges. tried increasing height of layers rotate, provided unsavory results.
any ideas? there way can manually set position on corner corner basis?
i think part of problem anchor points on center line. during rotation, top , bottom edges getting closer pov, rather center line getting farther away. can see corners off screen limiting amount can see effect. had had version anchor points on top , bottom of layers, unable 2 layers remain "touching" animation occurred. had tried adding translate z coordinate during animation, seemed have no effect on anything.
the value using (-1.0/2000.0) corresponds object beingness far away camera/eye , has low perspective. if want has more perspective should alter corresponds smaller distance camera. range of circa 500-800 "normal" distance, looking in 200-400 range.
that is: alter .m34 value -1.0/200.0 , there more perspective.
ios core-animation catransform3d
No comments:
Post a Comment