博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS开发 仿淘宝,京东商品详情3D动画
阅读量:4635 次
发布时间:2019-06-09

本文共 1900 字,大约阅读时间需要 6 分钟。

- (void)show {

  [[UIApplication sharedApplication].windows[0] addSubview:self.projectView];

  CGRect frame = self.projectView.frame;

  frame.origin.y = fView_Height(self.view) - 480*DY_Proportion;

  @weakify(self)

  [UIView animateWithDuration:0.25 animations:^{

    @strongify(self)

    [self.groundView.layer setTransform:[self firstTransform]];//红色view调用了上面的旋转效果

  } completion:^(BOOL finished) {

    @strongify(self)

    [UIView animateWithDuration:0.25 animations:^{

      @strongify(self)

      //旋转完成以后页面缩小 同事改变黄色页面的frame的y值

      [self.groundView.layer setTransform:[self secondTransform]];

      //显示maskView

      [self.maskView setAlpha:0.5f];

      //popView上升

      self.projectView.frame = frame;

    } ];

  }];

}

 

- (void)close { 

  CGRect frame = self.projectView.frame;

  frame.origin.y = fView_Height(self.view) + 30*DY_Proportion;

  @weakify(self)

  [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{

    @strongify(self)

    //maskView隐藏

    [self.maskView setAlpha:0.f];

    //popView下降

    self.projectView.frame = frame;

    //同时进行 感觉更丝滑

    [self.groundView.layer setTransform:[self firstTransform]];

    

  } completion:^(BOOL finished) {

    @strongify(self)

    [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{

      @strongify(self)

      //变为初始值

      [self.groundView.layer setTransform:CATransform3DIdentity];

      

    } completion:^(BOOL finished) {

      @strongify(self)

      //移除

      [self.projectView removeFromSuperview];

    }];

    

  }];

}

 

- (CATransform3D)firstTransform{

  CATransform3D t1 = CATransform3DIdentity;

  t1.m34 = 1.0/-900;

  //带点缩小的效果

  t1 = CATransform3DScale(t1, 0.98, 0.98, 1);

  //绕x轴旋转

  t1 = CATransform3DRotate(t1, 15.0 * M_PI/180.0, 1, 0, 0);

  return t1;

  

}

 

- (CATransform3D)secondTransform{

  

  CATransform3D t2 = CATransform3DIdentity;

  t2.m34 = [self firstTransform].m34;

  //向下移

  t2 = CATransform3DTranslate(t2, 0, 0, 0);

  //第二次缩小

  t2 = CATransform3DScale(t2, 0.90, 0.90, 1);

  return t2;

}

 

转载于:https://www.cnblogs.com/diweinan/p/6213959.html

你可能感兴趣的文章
函数名作为参数传递
查看>>
apt-get for ubuntu 工具简介
查看>>
数值计算算法-多项式插值算法的实现与分析
查看>>
day8-异常处理与网络编程
查看>>
杭州某知名xxxx公司急招大量java以及大数据开发工程师
查看>>
[转]char * 和字符数组
查看>>
io流中的txt文件编码更改
查看>>
百练-16年9月推免-B题-字符串判等
查看>>
SMTP 服务器要求安全连接或客户端未通过身份验证的各个解决方案(C#)
查看>>
UML概述
查看>>
ubuntu 软件包降级
查看>>
PHP 函数截图 哈哈哈
查看>>
1044. Shopping in Mars
查看>>
秒懂数据类型的真谛—Python基础前传(4)
查看>>
Linux bashrc和profile的用途和区别
查看>>
信息采集-火车采集器
查看>>
自定义View控件(2—手写实例代码)
查看>>
理解列存储索引
查看>>
android viewpage预加载和懒加载问题
查看>>
android 去掉标题栏、状态栏、横屏
查看>>