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

    }

  • 相关阅读:
    DW吃瓜课程——机器学习理论知识笔记(四)
    DW吃瓜课程——机器学习理论知识笔记(三)
    DW吃瓜课程——机器学习理论知识笔记(二)
    DW吃瓜课程——机器学习理论知识笔记(一)
    DataWhale编程实践——区块链学习笔记
    CV入门系列笔记——全球人工智能技术创新大赛【热身赛】CV异常检测赛道
    强化学习入门笔记系列——DDPG算法
    强化学习入门笔记系列——稀疏奖赏和模仿学习
    强化学习入门笔记系列——DQN算法
    Java_SPI思想
  • 原文地址:https://www.cnblogs.com/diweinan/p/6213959.html
Copyright © 2020-2023  润新知