您的位置:首页 > 产品设计 > UI/UE

UIView动画

2016-01-25 19:21 316 查看
1.block式动画

横向或纵向移动XY

[UIView animateWithDuration:0.5 animations:^{

self.aView.frame = CGRectMake(_aView.frame.origin.x, _aView.frame.origin.y + 50, _aView.frame.size.width, _aView.frame.size.height);

}];

或者

[UIView animateWithDuration:0.5 animations:^{

//_aView.transform = CGAffineTransformMakeTranslation(0, 20);

_aView.transform = CGAffineTransformTranslate(_aView.transform, 10, 10);

}];

渐变效果

[UIView animateWithDuration:0.5 animations:^{

_aView.alpha = !_aView.alpha;

}];

2.头尾式动画 ---翻页效果

[UIView beginAnimations:nil context:nil] 开始配置动画

[UIView setAnimationDuration:0.5];

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:_aview cache:NO];

[UIView commitAnimations] 配置完毕,提交动画

旋转效果

旋转一次

[UIView animateWithDuration:0.5 animations:^{

_aView.transform = CGAffineTransformMakeRotation(M_PI);

}];

旋转多次

[UIView animateWithDuration:0.5 animations:^{

_aView.transform = CGAffineTransformRotate(_aView.transform, M_PI_4);

}];

放大效果

[UIView animateWithDuration:0.2 animations:^{

//_aView.transform = CGAffineTransformMakeScale(2, 2);

_aView.transform = CGAffineTransformScale(_aView.transform, 1.1, 1.1);

}];

缩小

[UIView animateWithDuration:0.5 animations:^{

_aView.transform = CGAffineTransformMakeScale(0.5, 0.5);

}];

还原

_PinkView.transform = CGAffineTransformIdentity;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: