1.弹出动画效果
/**
弹出效果
@param itemView 弹出的View
@param center 弹出View的中心坐标
*/
- (void)appearMenuItem:(UIView *)itemView andCenter:(CGPoint)center {
UIViewPropertyAnimator *animator = [[UIViewPropertyAnimator alloc] initWithDuration:0.25 curve:UIViewAnimationCurveEaseOut animations:^{
itemView.center = center;
}];
[animator startAnimation];//animator.startAnimation(afterDelay:2.5)//可以延迟出现
}
2.弹跳效果
/**
弹跳效果
@param itemView 弹跳的View
@param center 弹跳View的中心坐标
*/
- (void)appearMenuItem:(UIView *)itemView andCenter:(CGPoint)center {
UIViewPropertyAnimator *animator = [[UIViewPropertyAnimator alloc] initWithDuration:1 dampingRatio:0.4 animations:^{
itemView.center = center;
}];
[animator startAnimation];//animator.startAnimation(afterDelay:2.5)//可以延迟出现
}
3.消失效果
/**
消失效果
@param itemView 消失的View
@param center 消失View的中心坐标
*/
- (void)appearMenuItem:(UIView *)itemView andCenter:(CGPoint)center {
UIViewPropertyAnimator *animator = [[UIViewPropertyAnimator alloc] initWithDuration:2 curve:UIViewAnimationCurveEaseOut animations:^{
itemView.alpha = 0;
}];
[animator addAnimations:^{
itemView.center = center;
}];
[animator startAnimation];
}