아래와 같이 "쉽고 쉬운"방법을 사용할 수 있습니까? 곡선에 여전히 EaseOut
이 사용 된 것으로 보입니다.ios UIView 애니메이션 곡선
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView animateWithDuration:0.5 animations:^{
// ... do stuff here
}];
아래와 같이 "쉽고 쉬운"방법을 사용할 수 있습니까? 곡선에 여전히 EaseOut
이 사용 된 것으로 보입니다.ios UIView 애니메이션 곡선
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView animateWithDuration:0.5 animations:^{
// ... do stuff here
}];
두 가지 종류의 UIView 애니메이션을 혼합합니다. 다음 중 하나와 같은 것을 사용해야합니다.
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
// ... do stuff here
} completion:NULL];
이것은 최신 블록 기반 UIView 애니메이션 API에서 가져온 것입니다. 그들은 같은 일을
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
// ... do stuff here
[UIView commitAnimations];
와 애플은 이후 블록 기반 API를 권장하지만 당신은 (중 하나를 사용할 수 있습니다 : 첫 번째 라인은, 다른 한편으로는, 다음과 같습니다 이전에 UIView 애니메이션 API의 일부입니다 애니메이션이 끝나면 콜백을하는 것이 더 쉽고 깔끔합니다).
코어 애니메이션, CAKeyFrameAnimation을 사용하여 커브 포인트를 정의 할 수 있습니다. 이 튜토리얼을 참조하십시오 : http://nachbaur.com/blog/core-animation-part-4
인접한 점들의 각 쌍에 대해 곡선 점 p1, p2, p3, p4 및 p5, &을 찾습니다. m1에 p1 및 p2의 중간 점으로 레이블을 지정합니다. m2, m3, m4에 대해서도 마찬가지입니다.
코드 :
CGFloat screenHeight = self.view.frame.size.height;
CGFloat screenWidth = self.view.frame.size.width;
UIView *aniView = [[UIView alloc] initWithFrame:CGRectMake(50, screenHeight, 50, 50)];
[aniView setBackgroundColor:[UIColor redColor]];
aniView.layer.cornerRadius = 25.0;
[self.view addSubview:aniView];
UIBezierPath *movePath = [UIBezierPath bezierPath];
[movePath moveToPoint:aniView.center];
[movePath addQuadCurveToPoint:CGPointMake(screenWidth-50,screenHeight-50)
controlPoint:CGPointMake(screenWidth/2,screenHeight-150)];
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
moveAnim.path = movePath.CGPath;
moveAnim.removedOnCompletion = YES;
CAAnimationGroup *animGroup = [CAAnimationGroup animation];
animGroup.animations = [NSArray arrayWithObjects:moveAnim, nil];
animGroup.duration = 2.0;
[CATransaction begin]; {
[CATransaction setCompletionBlock:^{
[aniView.layer removeAllAnimations];
[aniView removeFromSuperview];
}];
[aniView.layer addAnimation:animGroup forKey:nil];
} [CATransaction commit];
복사 몇 가지 방법으로 코드 위의 과거와 메소드를 호출하려고 ... 링크 전용 답변 SO 여기에 낙담하는 것을
참고. [대답 편집] (http://meta.stackexchange.com/a/8259/186599)을 고려하고 여기에 개요를 추가하십시오. – NAZIK
@ NAZIK 귀하의 영광 저는 질문에 대답하고 querry에 대한 적절한 해결책을 찾으러 여기 있습니다! – Steve
나는이 튜토리얼을 끝내고, 내 업보트를 가져 갔다. – NAZIK