• iOS图片立体旋转


    图片做动画效果

    //动画开始

    -(void)startAnimationMsg

    {

        num = 0;

        self.timer = [NSTimer timerWithTimeInterval:0.4 target:self selector:@selector(updateAnimationMsg) userInfo:nil repeats:YES];

        [[NSRunLoop mainRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode];

        /*

        CABasicAnimation* rotationAnimation;

        rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];

        rotationAnimation.toValue = [NSNumber numberWithFloat: -M_PI * 2.0 ];

        rotationAnimation.duration = 2;

        rotationAnimation.cumulative = YES;

        rotationAnimation.repeatCount = 0;

        [self.OpenImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

            [self startAnimation];

        });

         */

    }

    -(void)updateAnimationMsg

    {

        switch (num) {

            case 0:

                self.OpenImageView.image = [UIImage imageNamed:@"img_open-02.png"];

                num ++;

                break;

            case 1:

                self.OpenImageView.image = [UIImage imageNamed:@"img_open-03.png"];

                num++;

                break;

            case 2:

                self.OpenImageView.image = [UIImage imageNamed:@"img_open-01.png"];

                num = 0;

                break;

            default:

                break;

        }

    }

    //动画结束

    -(void)endAnimationMsg

    {

         self.OpenImageView.image = [UIImage imageNamed:@"img_open-01.png"];

        [self.timer invalidate];

    }

     

  • 相关阅读:
    Lucene搜索引擎例子demo
    java Log4j日志配置详解大全
    java获取当前上一周、上一月、上一年的时间
    Django组件-cookie与session
    前端基础之jQuery
    Django组件-forms
    Django组件-分页器
    Django-Ajax
    Django模型层-多表操作
    Django模型层-单表操作
  • 原文地址:https://www.cnblogs.com/huzi213/p/7238224.html
Copyright © 2020-2023  润新知