IOS 实现3D 浮动效果动画
程序员文章站
2023-12-18 13:13:04
涉及到的技术点
catransform3drotate
转换坐标系
整体视图的层级结构
tvoscardview
ca...
涉及到的技术点
- catransform3drotate
- 转换坐标系
整体视图的层级结构
- tvoscardview
- cardimageview
- cardparallaxview
转换坐标系的代码
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动画的运行结果
文/joycezhao(简书作者)
原文链接:http://www.jianshu.com/p/42770b5cee0d
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。