标签:
-(void)positionAnimation{
_demoView.transform = CGAffineTransformIdentity;
[UIView animateWithDuration:1.0f animations:^{
_demoView.transform = CGAffineTransformMakeTranslation(100, 100);
}];
}
-(void)scaleAnimation{
_demoView.transform = CGAffineTransformIdentity;
[UIView animateWithDuration:1.0f animations:^{
_demoView.transform = CGAffineTransformMakeScale(2, 2);
}];
}
-(void)rotateAnimation{
_demoView.transform = CGAffineTransformIdentity;
[UIView animateWithDuration:1.0f animations:^{
_demoView.transform = CGAffineTransformMakeRotation(M_PI);
}];
}
-(void)combinationAnimation{
//仿射变换的组合使用
_demoView.transform = CGAffineTransformIdentity;
[UIView animateWithDuration:1.0f animations:^{
CGAffineTransform transform1 = CGAffineTransformMakeRotation(M_PI);
CGAffineTransform transform2 = CGAffineTransformScale(transform1, 0.5, 0.5);
_demoView.transform = CGAffineTransformTranslate(transform2, 100, 100);
}];
}
-(void)invertAnimation{
_demoView.transform = CGAffineTransformIdentity;
[UIView animateWithDuration:1.0f animations:^{
//矩阵反转
_demoView.transform = CGAffineTransformInvert(CGAffineTransformMakeScale(2, 2));
}];
}
CGAffineTransformEqualToTransform(CGAffineTransform t1,
CGAffineTransform t2) : 判断两个变换矩阵是否相等
CGAffineTransformConcat(CGAffineTransform t1,
CGAffineTransform t2) : 得到两个矩阵相加后得到的最终矩阵
CGPoint CGPointApplyAffineTransform(CGPoint point,
CGAffineTransform t) : 某点通过矩阵变换之后的点
CGSize CGSizeApplyAffineTransform(CGSize size, CGAffineTransform t) : 某个size通过矩阵变换之后的size
标签:
原文地址:http://www.cnblogs.com/sungk/p/5171083.html