5

애니메이션을 구현하려고합니다. iPhone 갤러리에 들어가서 이미지를 누르면 전체 화면 이미지가 나타납니다. 아래에서 휴지통 버튼이있는 툴바를 볼 수 있습니다. 이 버튼을 누르면 이미지가 애니메이션으로 삭제됩니다. 이 구현하려고하지만, 어떻게 이미지, 사과 사용의 변환을 구현하는 몰라요. 이 최고입니다, 내가 할 수있는 : 애니메이션, iPhone 포토 갤러리에서 삭제하는 경우

[UIView transitionWithView:self.view duration:0.1 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ 
     [self.view addSubview:scrollImageView]; 
    } completion:^(BOOL finished) { 
     [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ 
      CGRect frame = scrollImageView.frame; 
      frame.size = CGSizeMake(frame.size.width * 0.75, frame.size.height * 0.75); 
      frame.origin = CGPointMake((size.width - frame.size.width)/2, (size.height - frame.size.height)/2); 
      scrollImageView.frame = frame; 
     } completion:^(BOOL finished) { 
      [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ 
       CGRect frame = scrollImageView.frame; 
       frame.size = CGSizeMake(frame.size.width * 0.05, frame.size.height * 0.05); 
       frame.origin = CGPointMake(size.width, size.height); 
       scrollImageView.frame = frame; 
       CGAffineTransform transform = scrollImageView.transform; 
       CGAffineTransform rotatedTransform = CGAffineTransformRotate(transform, 45 * 3.14/180); 
       scrollImageView.transform = rotatedTransform; 
      } completion:^(BOOL finished) { 
       [scrollImageView removeFromSuperview]; 
      }]; 
     }]; 
    }]; 

미리 감사드립니다.

업데이트 내가 알고있는 것처럼, 내가 코어 애니메이션으로이 애니메이션을 할 수는 없지만, 누군가가 나에게하지만, OpenGL을 사용하지 않고 아이폰 갤러리 애니메이션에 가장 시뮬 애니메이션을 조언 할 수있다?

답변

3

Core Animation 또는 UIKit을 사용하여 말하는 정확한 애니메이션을 수행 할 수 없습니다. OpenGL을 사용하여 이미지를 텍스처로 적용하고 거기에 애니메이션을 적용해야합니다.

+0

는하지만, OpenGL을 사용하지 않고 나 애니메이션 아이폰 갤러리 애니메이션에 가장 시뮬에게 조언을 할 수 있습니까? –

+0

이전에 [블로그 게시물] (http://ronnqvist.tumblr.com/post/23234805389/unobtrusive-hints-of-joy)에서 Safari의 "Open in background"애니메이션을 복제하려고했습니다. 그것은 매우 유사하지만 동시에 매우 다릅니다. 아마 뭔가를 배우고 애니메이션에 필요한 부분을 적용 할 수 있습니다. –

6

이 애니메이션에 대한 다음 예제를 사용할 수 있습니다

내가 코드를 수정 한
UIView *senderView = (UIView*)sender; 

CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform"]; 
      anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
      anim.duration = 0.125; 
      anim.repeatCount = 1; 
      anim.autoreverses = YES; 
      anim.removedOnCompletion = YES; 
      anim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)]; 
      //[senderView.layer addAnimation:anim forKey:nil]; 


UIBezierPath *movePath = [UIBezierPath bezierPath]; 
      [movePath moveToPoint:icon.center]; 
      [movePath addQuadCurveToPoint:senderView.center 
          controlPoint:CGPointMake(senderView.center.x, icon.center.y)]; 

      CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 
      moveAnim.path = movePath.CGPath; 
      moveAnim.removedOnCompletion = YES; 

      CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform"]; 
      scaleAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; 
      scaleAnim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)]; 
      scaleAnim.removedOnCompletion = YES; 

      CABasicAnimation *opacityAnim = [CABasicAnimation animationWithKeyPath:@"alpha"]; 
      opacityAnim.fromValue = [NSNumber numberWithFloat:1.0]; 
      opacityAnim.toValue = [NSNumber numberWithFloat:0.1]; 
      opacityAnim.removedOnCompletion = YES; 

      CAAnimationGroup *animGroup = [CAAnimationGroup animation]; 
      animGroup.animations = [NSArray arrayWithObjects:moveAnim, scaleAnim, opacityAnim, nil]; 
      animGroup.duration = 0.5; 
      [icon.layer addAnimation:animGroup forKey:nil]; 

, 당신은, 그것의 변화 다음을 수행해야 self.view로 보낸보기를 설정하고의 끝 지점을 변경 애니메이션 (현재 senderView.center)은 귀하의 요구에 따라

+0

제발, 내 scrollImageView 및 self.view를 사용하여 excample을 바꿀 수 있습니까? 아이콘 대신 scrollImageView를 사용하려고했기 때문에 애니메이션이 끔찍한 데, 나는 뭔가를 이해하지 못한다고 생각합니다. –

+0

@ Paul Galavic - 이런 유형의 애니메이션을 만들었습니까? 궁금 해서요. 또한 구현하고 싶습니다. – TheFlash

0

나는 당신이 "빨기"전환 애니메이션에 대해 이야기하고 있다고 생각합니다.

트리거 할 수는 있지만 사적인 전환이므로 Apple에서 앱을 사용하는 경우이를 거부 할 수 있습니다.

:

이 코드 (103)의 전이 코드 사용하여 수행한다 [UIView의 beginAnimations : 닐 컨텍스트 : NULL을]; [UIView setAnimationDuration : 1.0]; [UIView setAnimationTransition : transtionIndex forView : containerView cache : NO]; [containerView addSubview : newView]; [oldView removeFromSuperview]; [UIView commitAnimations];

아니면 내가 조금 늦게 그것을 알고 "suckEffect"

4

이라는 코어 이미지 전환을위한 그물을 검색 할 수 있습니다. 그러나 Ciechan의 솔루션 BCGenieEffect을 확인해야합니다. 찾을 수 있습니다 here. 순수한 Core Animation으로 매우 이해하기 쉽습니다. 나는 그것이 당신이 찾고있는 것이라고 생각합니다.

행운

관련 문제