2012-02-27 2 views
0

저는 iOS 그래픽 및 애니메이션을 처음 사용하고 있으며 아래 비디오에서 볼 수 있듯이 영화의 운동량 회전 효과를 달성하는 방법을 알고 싶습니다. 가볍게하지 않을 경우 iOS에서 이미지의 운동량 회전

video

는 심지어 이미지는 좋은 영향력을 가지고있다.

감사합니다.

+1

오래된 물리학 교과서를 없애기 시작하십시오. –

+1

개인적으로는 물리 엔진을 사용하고 싶습니다. 처음에는 정상을 넘어서는 것처럼 보일지 모르지만 나 자신이 물리학을 쓰는 것을 저축합니다! –

+0

James, Chipmunk 또는 다른 물리 엔진을 사용하고 있습니까? –

답변

1

꽤 매끄럽습니다. 뷰를 한 점 (꼭대기의 중심)을 중심으로 회전시킨 다음 알고리즘 적으로 회전하는 데 필요한 시간을 변경하여 적절할 때 반전시킵니다. 나는 당신에게 코드를 줄 수는 없지만, Hegarty 교수가이 비디오 데모를 보게되면 필요한 툴을 얻을 수있을 것이라고 생각합니다. 그는 뷰 외부의 한 점을 중심으로 회전합니다. 뷰의 가장자리를 중심으로 회전 만하면됩니다 (뷰를 축소하지 마십시오). 그것을 체크 아웃 :

제 1 부 : http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/291

제 2 부 : http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/293

당신은 확실히 많은 설명이있는 한, 아이튠즈 U (무료) 해제 동영상을 다운로드 할 수 있습니다.

행운을 빌어 요,

데미안

0

나는이의 저자로 확인하고는 Box2D의 물리 라이브러리를 사용하여 구현 된 것을 통보했다. 나는 그에게 총을 줄 것이다. 답변 주셔서 감사합니다!

0
//this code can be used to rotate an image having both back and front 

    rotate = [UIButton buttonWithType:UIButtonTypeCustom]; 
     [rotate addTarget:self action:@selector(rotate1)forControlEvents:UIControlEventTouchDown]; 
     rotate.frame = CGRectMake(137.5, 245, 45, 46); 
     [rotate setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"viewing.png"]] forState:UIControlStateNormal]; 
     [self.view addSubview:rotate]; 

    int count; 
    count=0; 

    -(void)rotate1 
    { 


     count=count+1; 
     NSLog(@"rotate"); 
     [UIView transitionWithView:imagecircle // use the forView: argument 
          duration:1   // use the setAnimationDuration: argument 
          options:UIViewAnimationOptionTransitionFlipFromLeft 
     // check UIViewAnimationOptions for what options you can use 
         animations:^{   // put the animation block here 
          imagecircle.image = imagecircle.image; 
         } 
         completion:NULL]; 

     if(count%2==0) 
     { 
      NSLog(@"image.str.%@",appDelegate.imageNameString); 
      [imagecircle setImage:[UIImage imageNamed:appDelegate.imageNameString]]; 
      [labellocation removeFromSuperview]; 
      [labeldate removeFromSuperview]; 
      [self.imagecircle addSubview:labelfrom]; 

     } 
     else 
     { 
      [imagecircle setImage:[UIImage imageNamed:@"TGP_BACK.png"]]; 
      [labelfrom removeFromSuperview]; 
      [self.imagecircle addSubview:labellocation]; 
      [self.imagecircle addSubview:labeldate]; 
     } 



    } 
관련 문제