zoukankan      html  css  js  c++  java
  • 梦过来蒙过去,

    }elseif (self.panGesture.state == UIGestureRecognizerStateEnded)

        {

            endPoint = [self.panGesturelocationInView:self.moveView];

            CGPoint velocity = [self.panGesture velocityInView:self.moveView];

             vMax = sqrtf((velocity.x * velocity.x) + (velocity.y * velocity.y));

             aVelocity = 1000.0;

             useTime = vMax/aVelocity;

            [UIViewanimateWithDuration:useTimedelay:0options:UIViewAnimationOptionCurveEaseOutanimations:^{

                [self decelerateSetup];

            } completion:nil];

           [self.panGesturesetTranslation:CGPointMake(0, 0) inView:self.moveView];

    }

     

    //匀减速

    -(void)decelerateSetup

    {

        [timerinvalidate];

        timer = Nil;

        timer = [NSTimerscheduledTimerWithTimeInterval:0.001target:selfselector:@selector(decelerate:) userInfo:Nilrepeats:YES];

    }

     

    -(void)decelerate:(id)sender

    {

        usedTime = usedTime + 0.001;

        CGFloat v1 = vMax - aVelocity * usedTime;

      

        CGFloat passRoad = (vMax * vMax - v1 * v1)/(2*aVelocity);//代表弧度

        currentRadius = passRoad/320*2;//半径是 320

     

        currentRadius = passRoad/M_PI*2;

     

    //    if (endPoint.x > beginPoint.x) {

    //        currentRadius = -currentRadius;

    //    }

     

        if (v1 <= 0) {

            [timer invalidate];

            timer = Nil;

            useTime = 0;

            usedTime= 0;

            [[SoundManagershareSoundManager]stopPlay];

        }else{

            self.moveView.transform = CGAffineTransformMakeRotation(currentRadius);

        }

    }

  • 相关阅读:
    elastic
    Leetcode题库 第十行
    Leetcode题库-实现strStr()
    Redis持久化
    Redis的数据结构及应用场景
    Redis缓存的淘汰策略
    Redis缓存常见问题
    Redis面试题1
    消息队列的原理及选型
    【转载】java高并发/mysql/mybatis/spring博客
  • 原文地址:https://www.cnblogs.com/guligei/p/3654549.html
Copyright © 2011-2022 走看看