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);

        }

    }

  • 相关阅读:
    C,LINUX,数据结构部分
    LINUX应用开发工程师职位(含答案)
    INT32 System_UserKeyFilter(NVTEVT evt, UINT32 paramNum, UINT32 *paramArray)
    屏幕调试
    1.ARM嵌入式体系结构与接口技术(Cortex-A8版)
    NT9666X调试log
    DemoKit编译过程错误
    selenium 代理设置
    pandas 轮询dataframe
    Spring 定时任务
  • 原文地址:https://www.cnblogs.com/guligei/p/3654549.html
Copyright © 2011-2022 走看看