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;

    }

  • 相关阅读:
    varnish反向代理
    Asp.Net MVC 3.0
    反向代理(Reverse Proxy)
    Go语言开发Windows应用
    Windows下安装NodeJS和CoffeeScript方法
    数据库设计....
    发布一个开源的c++网络事件库
    非小型电子商务系统设计经验分享 Coding changes the world
    SqlServer查询计划
    cocos2dx总结(一)HelloWord
  • 原文地址:https://www.cnblogs.com/diweinan/p/6213959.html
Copyright © 2011-2022 走看看