1. UIView的,翻转、旋转,偏移,翻页,缩放,取反的动画效果
  2. 翻转的动画
  3. //开始动画
  4. [UIView beginAnimations:@”doflip” context:nil];
  5. //设置时常
  6. [UIView setAnimationDuration:1];
  7. //设置动画淡入淡出
  8. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
  9. //设置代理
  10. [UIView setAnimationDelegate:self];
  11. //设置翻转方向
  12. [UIView setAnimationTransition:
  13. UIViewAnimationTransitionFlipFromLeft forView:manImageView cache:YES];
  14. //动画结束
  15. [UIView commitAnimations];
  16. 旋转动画
  17. 创建一个CGAffineTransform transform对象
  18. CGAffineTransform transform;
  19. //设置旋转度数
  20. transform = CGAffineTransformRotate(manImageView.transform,M_PI/6.0);
  21. //动画开始
  22. [UIView beginAnimations:@”rotate” context:nil ];
  23. //动画时常
  24. [UIView setAnimationDuration:2];
  25. //添加代理
  26. [UIView setAnimationDelegate:self];
  27. //获取transform的值
  28. [manImageView setTransform:transform];
  29. //关闭动画
  30. [UIView commitAnimations];
  31. 偏移动画
  32. [UIView beginAnimations:@”move” context:nil];
  33. [UIView setAnimationDuration:2];
  34. [UIView setAnimationDelegate:self];
  35. //改变它的frame的x,y的值
  36. manImageView.frame=CGRectMake(100,100, 120,100);
  37. [UIView commitAnimations];
  38. 翻页动画
  39. [UIView beginAnimations:@”curlUp” context:nil];
  40. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];//指定动画曲线类型,该枚举是默认的,线性的是匀速的
  41. //设置动画时常
  42. [UIView setAnimationDuration:1];
  43. [UIView setAnimationDelegate:self];
  44. //设置翻页的方向
  45. [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:manImageView cache:YES];
  46. //关闭动画
  47. [UIView commitAnimations];
  48. 缩放动画
  49. CGAffineTransform transform;
  50. transform = CGAffineTransformScale(manImageView.transform,1.2,1.2);
  51. [UIView beginAnimations:@”scale” context:nil];
  52. [UIView setAnimationDuration:2];
  53. [UIView setAnimationDelegate:self];
  54. [manImageView setTransform:transform];
  55. [UIView commitAnimations];
  56. 取反的动画效果是根据当前的动画取他的相反的动画
  57. CGAffineTransform transform;
  58. transform=CGAffineTransformInvert(manImageView.transform);
  59. [UIView beginAnimations:@”Invert” context:nil];
  60. [UIView setAnimationDuration:2];//动画时常
  61. [UIView setAnimationDelegate:self];
  62. [manImageView setTransform:transform];//获取改变后的view的transform
  63. [UIView commitAnimations];//关闭动画