zoukankan      html  css  js  c++  java
  • 动画的节奏

     转自  http://zhangmingwei.iteye.com/blog/2307678

    ///设置动画的节奏。。。。EaseIn 就是刚进入的时候慢。。。

    animation.timingFunctino  = [CAMediaTimingFunction functionWithName:KCAMediaTimingFunctionEaseInaseOut];

     

            // 设置锚点和位置,,,默认锚点为0.0、右下角为1,1

            btn.layer.anchorPoint = CGPointMake(0.5, 1);

            btn.layer.position = CGPointMake(self.centerWheel.frame.size.width * 0.5, self.centerWheel.frame.size.height * 0.5);

     

        if (self.link) return;

        

        // 1秒内刷新60次——刷新快的时候比NSTimer好。

        CADisplayLink *link = [CADisplayLink displayLinkWithTarget:self selector:@selector(update)];

        [link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];

     

        self.link = link;

     

    - (void)update

    {

        self.centerWheel.transform = CGAffineTransformRotate(self.centerWheel.transformM_PI / 500);

     

    }

     

     

     

     

    /**

     *  开始选号

     */

    - (IBAction)startChoose {

        [selfstopRotating];

        

        CABasicAnimation *anim = [CABasicAnimationanimation];

        anim.keyPath = @"transform.rotation";

        anim.toValue = @(2 * M_PI * 3);

        anim.duration = 1.5;

        // 开头和结尾比较慢,中间快

        anim.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];

        anim.delegate = self;

        [self.centerWheel.layeraddAnimation:anim forKey:nil];

        

        self.userInteractionEnabled = NO;

    }

     

    - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag

    {

        

        

        self.userInteractionEnabled = YES;

    ///两秒后执行里面的方法。

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

            [selfstartRotating];

        });

     

    }

    创建 git 的项目。。。git init  git add .   git commit -m ""    

     然后在github 网站创建自己的名字尽量保证一致。

    把地址复制 出来 git remote add origin https://github.com/hanhailong/CustomRatingBar

    第六步:上传github之前,要先pull一下,执行如下命令:

    git pull origin master

    git push -u origin master

  • 相关阅读:
    强人工智能基本问题:全局控制与自组织
    程序员,为未来准备好了吗?
    强人工智能基本问题:自上而下,还是自下而上。
    强人工智能基本问题:神经网络分层还是不分层
    什么阻碍了强人工智能的发展
    人类和强人工智能的关系(人类会被灭掉吗?)
    为什么需要强人工智能
    神经网络和机器学习、强人工智能
    重新开张!
    Xcode文件乱序
  • 原文地址:https://www.cnblogs.com/wanghuaijun/p/5662909.html
Copyright © 2011-2022 走看看