关于transform的一些用法
来源:互联网 发布:知乎女神芈十四 编辑:程序博客网 时间:2024/04/30 05:12
旋转 缩放 偏移 反转
iphone中动画的实现主要分为两种,UIView动画 和Core Animation动画
UIView动画主要可以实现的效果包括:
1.frame,bounds,center//改变View的frame属性
1 -(void)doChangeFrame 2 { 3 //{ 4 // [UIView beginAnimations:nil context:nil]; 5 // [UIView setAnimationDuration:2]; 6 // [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 7 // [UIView setAnimationDelegate:self]; 8 // [UIView setAnimationDidStopSelector:@selector(stopDelegate)]; 9 // smallImage.frame = CGRectMake(150, 80, 30, 30);10 // 11 // //smallImage.alpha = 0;12 // [UIView commitAnimations];13 14 [UIView animateWithDuration:2.0 animations:^(void){smallImage.frame = CGRectMake(150, 80, 30, 30);} completion:^(BOOL finished) {15 smallImage.alpha = 0;16 }];17 //块语句定义及使用方法18 /*int (^myBlock )(int num) = ^(int num)19 {20 return num*2;21 };22 NSLog(@"%d",myBlock(7));*/23 }
2.alpha //改变透明度
3.backgroundColor //改变背景颜色
4.contentStretch //拉伸变化
5.transform //仿射变换,其中又包括Rotate,Invert,Translate,Scale(旋转,反转,位移,缩放)
1 -(void)doRotate//旋转2 {3 CGAffineTransform transform= CGAffineTransformMakeRotation(M_PI/4);4 5 [UIView beginAnimations:nil context:nil];6 bigImage.transform = transform;7 [UIView commitAnimations];8 }
1 -(void)doInvert//反转 2 { 3 BOOL isSingle = seg.selectedSegmentIndex; 4 //如果单次 直接翻转到原始状态 如果连续 在以前基础上再次进行反转 5 6 CGAffineTransform transform = isSingle?CGAffineTransformInvert(bigImage.transform):CGAffineTransformIdentity; 7 8 [UIView beginAnimations:nil context:nil]; 9 bigImage.transform = transform;10 [UIView commitAnimations];11 }
1 -(void)doTranslate//位移 2 { 3 BOOL isSingle = seg.selectedSegmentIndex; 4 //如果单次 只改变一次 如果连续 在以前基础上再次进行移位 5 CGAffineTransform transform = isSingle?CGAffineTransformMakeTranslation(10, 10):CGAffineTransformTranslate(bigImage.transform, 10, 10); 6 7 // [UIView beginAnimations:nil context:nil]; 8 // bigImage.transform = transform; 9 // [UIView commitAnimations];10 [UIView animateWithDuration:1 animations:^{11 bigImage.transform = transform;12 }];13 }
1 -(void)doScale//缩放 2 { 3 BOOL isSingle = seg.selectedSegmentIndex; 4 //如果单次 只改变一次 如果连续 在以前基础上再次进行缩放 5 CGAffineTransform transform = isSingle?CGAffineTransformMakeScale(1.0, 1.1):CGAffineTransformScale(bigImage.transform, 1.0, 1.1); 6 7 [UIView beginAnimations:nil context:nil]; 8 bigImage.transform = transform; 9 [UIView commitAnimations];10 11 }
0 0
- 关于transform的一些用法
- transform的一些属性
- 鑫空间关于css3中transform的用法解释
- TransForm的用法
- 关于transform的应用
- 关于数组的一些用法
- 关于system()的一些用法
- 一些 关于 控件的用法
- 关于CListCtrl的一些用法
- 关于const的一些用法
- 关于struct的一些用法
- 关于AlertDialog 的一些用法
- 关于枚举的一些用法
- 关于Flurry的一些用法
- 关于Datatable的一些用法
- 关于指针的一些用法
- 关于controller的一些用法
- 关于sort的一些用法
- 电容自谐振频率
- [LeetCode] Sqrt(x)
- Android 中的DisplayMetrics类的用法
- BBB学习之路
- 获取对象的类名,属性及方法列表
- 关于transform的一些用法
- Maven的Snapshot版本与Release版本
- 天猫11.11:搜索引擎实时秒级更新
- 电容、频率之间的关系
- 影视并购,是谁写的万能故事大纲?
- HDU 3853 期望概率DP
- Python访问MySQL封装的常用类实例
- 安卓滤镜效果
- error:“0x0000 0001”指令引用的““0x0000 0001””内存,该内存不能为“read”