iOS绘图与动画

模拟tvOS中的3D浮动效果动画

2016-09-01  本文已影响304人  JoyceZhao
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;
运行结果图8.gif
附上项目所在GitHub地址:https://github.com/zhaoqianJoyce/tvOSCardAnimation
上一篇下一篇

猜你喜欢

热点阅读