zoukankan      html  css  js  c++  java
  • iOS开发 仿淘宝,京东商品详情3D动画

    - (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;

    }

  • 相关阅读:
    编译安装Nginx和php搭建KodExplorer网盘
    mysql二进制安装及基础操作
    Apache环境下搭建KodExplorer网盘
    编译安装Apache httpd和php搭建KodExplorer网盘
    KodExplorer介绍
    Nginx反向代理、负载均衡及日志
    Nginx include和Nginx指令的使用
    Nginx auto_index和auth_basic
    [译]在 64bit 环境中执行32 bit的SSIS包
    [译]SSIS 通过环境变量配置数据源连接参数
  • 原文地址:https://www.cnblogs.com/diweinan/p/6213959.html
Copyright © 2011-2022 走看看