• iOS开发只简单动画实现


    1.动画旋转:

        [UIViewbeginAnimations:@"View Flip"context:nil];     //声明,@"XX"为标题,
        [UIViewsetAnimationDuration:1.25];                           //持续时间
        [UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut];  //设置动画曲线
              //加入新的坐标
         
              //旋转视图
        [UIViewsetAnimationTransition:UIViewAnimationTransitionFlipFromRight
                              forView:self.viewcache:YES];  ///调用

    2.左右晃动动画:

     // start the wiggling animation
       CGFloatrotation =0.03;
       
       CABasicAnimation*shake = [CABasicAnimation animationWithKeyPath:@"transform"];
        shake.duration = 0.13;
        shake.autoreverses = YES;
        shake.repeatCount  = MAXFLOAT;
        shake.removedOnCompletion = NO;
        shake.fromValue = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform,-rotation, 0.0 ,0.0 ,1.0)];
        shake.toValue  = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform, rotation, 0.0 ,0.0 ,1.0)];
       
        [self.layeraddAnimation:shake forKey:@"shakeAnimation"];
      
    //然后在退出的时候移除
     [self.layer removeAnimationForKey:@"shakeAnimation"];

    3、

        CATransform3D transformBefore = CATransform3DIdentity;
        transformBefore.m34 = 0.0005;
        transformBefore = CATransform3DRotate(transformBefore,(M_PI/180*270), 0, 1, 0);
        instroduceLayer.layer.transform = transformBefore;   
        instroduceLayer.layer.anchorPoint = CGPointMake(0.0, 0.5);
       
        [UIViewanimateWithDuration:1animations:^{
            CATransform3D transform = CATransform3DIdentity;//单位矩阵
            transform.m34 = 0.0005;
            transform = CATransform3DRotate(transform,(M_PI/180*0), 0, 1, 0);
            instroduceLayer.layer.transform = transform;
        }];
  • 相关阅读:
    2017-3-7 leetcode 66 119 121
    2017-3-6 leetcode 118 169 189
    2017-3-5 leetcode 442 531 533
    c++ std
    2017-3-4 leetcode 414 485 495
    2017-3-3 leetcod 1 35 448
    想做手游
    编程规范
    1165: 零起点学算法72——首字母变大写
    1164: 零起点学算法71——C语言合法标识符(存在问题)
  • 原文地址:https://www.cnblogs.com/ios-wmm/p/10215225.html
Copyright © 2020-2023  润新知