iOS修改transform形变也能够实现动画
2017-08-27 11:03
337 查看
之前的一篇文章提到UIView实现动画里面核心是修改frame,其实修改transform形变也能够实现动画
- (IBAction)moveUp:(id)sender {
//平移
[UIView animateWithDuration:0.5 animations:^{
//使用Make,它是相对于最原始的位置做的形变.
//self.imageV.transform = CGAffineTransformMakeTranslation(0, -100);
//相对于上一次做形变.
self.imageV.transform = CGAffineTransformTranslate(self.imageV.transform, 0, -100);
}];
}
- (IBAction)moveDown:(id)sender {
//平移
[UIView animateWithDuration:0.5 animations:^{
//使用Make,它是相对于最原始的位置做的形变.
//self.imageV.transform = CGAffineTransformMakeTranslation(0, -100);
//相对于上一次做形变.
self.imageV.transform = CGAffineTransformTranslate(self.imageV.transform, 0, 100);
}];
}
- (IBAction)rotation:(id)sender {
[UIView animateWithDuration:0.5 animations:^{
//旋转(旋转的度数, 是一个弧度)
//self.imageV.transform = CGAffineTransformMakeRotation(M_PI_4);
self.imageV.transform = CGAffineTransformRotate(self.imageV.transform, M_PI_4);
}];
}
- (IBAction)scale:(id)sender {
[UIView animateWithDuration:0.5 animations:^{
//缩放
//self.imageV.transform = CGAffineTransformMakeScale(0.5, 0.5);
self.imageV.transform = CGAffineTransformScale(self.imageV.transform, 0.8, 0.8);
}];
}
- (IBAction)moveUp:(id)sender {
//平移
[UIView animateWithDuration:0.5 animations:^{
//使用Make,它是相对于最原始的位置做的形变.
//self.imageV.transform = CGAffineTransformMakeTranslation(0, -100);
//相对于上一次做形变.
self.imageV.transform = CGAffineTransformTranslate(self.imageV.transform, 0, -100);
}];
}
- (IBAction)moveDown:(id)sender {
//平移
[UIView animateWithDuration:0.5 animations:^{
//使用Make,它是相对于最原始的位置做的形变.
//self.imageV.transform = CGAffineTransformMakeTranslation(0, -100);
//相对于上一次做形变.
self.imageV.transform = CGAffineTransformTranslate(self.imageV.transform, 0, 100);
}];
}
- (IBAction)rotation:(id)sender {
[UIView animateWithDuration:0.5 animations:^{
//旋转(旋转的度数, 是一个弧度)
//self.imageV.transform = CGAffineTransformMakeRotation(M_PI_4);
self.imageV.transform = CGAffineTransformRotate(self.imageV.transform, M_PI_4);
}];
}
- (IBAction)scale:(id)sender {
[UIView animateWithDuration:0.5 animations:^{
//缩放
//self.imageV.transform = CGAffineTransformMakeScale(0.5, 0.5);
self.imageV.transform = CGAffineTransformScale(self.imageV.transform, 0.8, 0.8);
}];
}
相关文章推荐
- IOS开发-CGAffineTransform的用法,实现一些简单动画效果
- ios-动画实现修改约束
- iOS swift-自定义转场动画_实现modal控制器显示与消失时的透明度渐变
- iOS开发中实现动画效果的多种方法
- IOS 利用麦克风声音来实现吹裙子的动画效果
- iOS 自定义转场动画实现小红书的push效果思路以及下雪碎屏等动画的实现
- iOS 转场动画简单实现 (push)
- ios animation 动画效果实现
- iOS动画效果和实现
- iOS动画系列之九:实现点赞的动画及播放起伏指示器
- iOS一种高斯模糊渐变动画的实现
- iOS实现滚动字幕的动画特效
- iOS开发-UIView之动画效果的实现方法(合集)
- IOS开发-UIView之动画效果的实现方法(合集)
- ios 实现系统加载动画 红色小菊花
- ios中开发在cell上实现内容的动画滑动效果
- iOS使用约束实现动画效果
- iOS开发-UIView之动画效果的实现方法(合集)
- IOS动画实现(2)ImageView自带动画
- ios高级动画的简单实现