The technical points involved
- Catransform3drotate
- Transformation coordinate system
Hierarchy of the overall view
- Tvoscardview
- Cardimageview
- Cardparallaxview
Code to transform a coordinate system
CGFloat xfactor = MIN (1, MAX ( -1, (Touchpoint.x-(SELF.BOUNDS.SIZE.WIDTH/2))/(SELF.BOUNDS.SIZE.WIDTH/2));
CGFloat yfactor = MIN (1, MAX ( -1, (Touchpoint.y-(SELF.BOUNDS.SIZE.HEIGHT/2))/(SELF.BOUNDS.SIZE.HEIGHT/2));
CardImageView.layer.transform = [Self transformwithm34:1.0/ -500 xf:xfactor yf:yfactor];
CardParallaxView.layer.transform = [Self transformwithm34:1.0/ -250 xf:xfactor yf:yfactor];
CGFloat zfactor = 180 * ATAN (yfactor/xfactor)/M_pi + 90;
Tvoscardanimation Animation's Running results
Wen/joycezhao (author of Jane book)
Original link: http://www.jianshu.com/p/42770b5cee0d
Copyright belongs to the author, reproduced please contact the author to obtain authorization, and labeled "Jane book author."