회전에 UIViewAnimationCurve를 사용하고 위치 변경에 대해 하나의 UIViewAnimationCurve를 사용할 수 있기를 원합니다. 이것이 가능한가?동일한 애니메이션에서 두 개의 다른 UIViewAnimationCurves 사용
예를 들어 (의사 코드로);
// Begin animations
// Set rotation animation curve to EaseInOut
// Set position animation curve to Linear
// Make some changes to position
// Make some change to the angle of rotation
// Commit the animations
편집 : (CAAnimationGroup 방법은 아래의 제안) - 2 개의 별도 CABasicAnimations을 만든 및 CAAnimationGroup 그러나 애니메이션이 시작되지 않습니다. 어떤 아이디어?
CABasicAnimation *postionAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
postionAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
postionAnimation.toValue = [NSValue valueWithCGPoint:[self transformPointToWorldSpaceFromViewSpace:self.spriteView.position]];
postionAnimation.delegate = self;
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.z"];
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
rotationAnimation.toValue = [NSNumber numberWithFloat:self.spriteView.angle -= M_PI_2];
rotationAnimation.delegate = self;
CAAnimationGroup *animationsGroup = [CAAnimationGroup animation];
animationsGroup.duration = self.clockSpeed;
animationsGroup.animations = [NSArray arrayWithObjects:postionAnimation, rotationAnimation, nil];
// Perform the animation
[self.spriteView.layer addAnimation:animationsGroup forKey:nil];
Duncan에게 감사드립니다. 내일 갈거야. Dave –
안녕 Duncan,이 일을하고 치료를 작동! 내가 가진 유일한 질문은, 내 자체 [transformPointToViewSpaceFromWorldSpace : self.spriteView.position] 내 블록을 호출하는 것이 좋습니다? 그것은 작동하고 악기는 누출을 보이지 않지만 블록 내에서 자기를 사용하는 것에 대해 막연하게 기억합니다. 다시 한번 감사드립니다, Dave. –