zoukankan      html  css  js  c++  java
  • 抖动代码

    //

    //  ViewController.m

    //  01-抖动

    //

    //  Created by Lenny  on 3/16/15.

    //  Copyright (c) 2015 Lenny. All rights reserved.

    //


    #import "ViewController.h"

    #define angle2Radian(angle) ((angle) / 180.0 * M_PI)

    @interface ViewController ()


    @property (weaknonatomicIBOutlet UIView *imageView;

    @end


    @implementation ViewController


    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

    //    1.创建核心动画

        CAKeyframeAnimation * kfr = [[CAKeyframeAnimation alloc]init];

        //    2.创建核心动画的类型

        kfr.keyPath = @"transform.rotation";

    //    度数/ 180.0 *M_PI

        kfr.values = @[@(-angle2Radian(4))@(angle2Radian(4))@(-angle2Radian(4))];

        kfr.removedOnCompletion = NO;

        kfr.fillMode = kCAFillModeBackwards;

        kfr.duration = 0.1;

    //    设置反复次数

        kfr.repeatCount = MAXFLOAT;


    //    3加入核心动画

        [self.imageView.layer addAnimation:kfr forKey:nil];

    }

    @end


  • 相关阅读:
    排球教练积分程序
    排球积分程序
    排球积分程序
    14周总结
    本周总结
    排球计分规则
    我与计算机
    排球计分程序
    《如何成为一个高手》观后感
    十八周总结
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5141692.html
Copyright © 2011-2022 走看看