IOS Animation动画基础
来源:互联网 发布:安卓手机java编程软件 编辑:程序博客网 时间:2024/04/29 11:43
-(void)createTredition
{
//1.创建动画
UIView*animationView=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
animationView.tag=100;
animationView.backgroundColor=[UIColor orangeColor];
[self.view addSubview:animationView];
//两个参数 1 是动画的标示 2 个式动画携带的内容
[UIView beginAnimations:@"123" context:(__bridge void *)(animationView)];
//设置动画延迟时间
[UIView setAnimationDelay:2];
//设置代理监控动画何时开始和结束
[UIView setAnimationDelegate:self];
//动画开始方法
[UIView setAnimationWillStartSelector:@selector(animationDidStart:context:)];
//动画结束
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
//2 动画持续时间
[UIView setAnimationDuration:2];
//3 动画的动作 修该坐标信息 改变颜色 改变变量 改变透明度
animationView.frame=self.view.bounds;
animationView.backgroundColor=[UIColor greenColor];
animationView.alpha=0.4;
animationView.transform=CGAffineTransformMakeRotation( M_PI_4);
//4动画的提交
[UIView commitAnimations];
}
//2 block 动画的方式
-(void)creatBlockAnimation
{
UIView*animationView=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
animationView.tag=100;
animationView.backgroundColor=[UIColor orangeColor];
[self.view addSubview:animationView];
[UIView animateWithDuration:3 animations:^{
animationView.frame=self.view.bounds;
}];
[UIView animateWithDuration:3 animations:^{
animationView.backgroundColor=[UIColor yellowColor];
//animationView.frame=self.view.bounds;
} completion:^(BOOL finished) {
//动画完成要走的地方
[UIView animateWithDuration:3 animations:^{
animationView.frame=self.view.bounds;
}];
}];
// delay延迟时间
[UIView animateWithDuration:5 delay:2 options:UIViewAnimationOptionLayoutSubviews animations:^{
animationView.transform=CGAffineTransformMakeRotation(M_PI_4);
animationView.backgroundColor=[UIColor greenColor];
} completion:^(BOOL finished) {
[UIView animateWithDuration:3 animations:^{
animationView.frame=self.view.bounds;
animationView.backgroundColor=[UIColor brownColor];
}];
}];
}
//动画结束执行的方法必须包含 动画标示 携带的内容 和是否动画完成 三个参数
//动画执行的方法 必须携带动画标示和内容两个参数
- (void)animationDidStart:(NSString *)animationID context:(void *)context
{
NSLog(@"animationID=%@,countext=%@",animationID,context);
}
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
BOOL ret=finished.boolValue;
NSLog(@"nimationID=%@ context=%@ finish=%d",animationID,context,ret);
}
- IOS Animation动画基础
- IOS 基础动画Core Animation
- iOS 动画Animation-1: 动画基础:Block动画
- iOS 动画Animation-2-1: 动画基础:核心动画简介
- iOS 动画Animation-2-2: 动画基础:核心动画
- Android Animation基础动画
- 【CSS基础 】动画animation
- Android animation基础动画
- IOS 动画(Animation)
- ios Core Animation 动画
- IOS-动画Animation
- animation iOS实现动画
- iOS 动画(Animation)总结
- ios animation动画
- ios之UIView执行基础动画Animation使用参数配置
- iOS - 动画Animation零基础完全教程之一
- android Animation动画效果基础
- 动画效果编程基础--Animation
- 高通平台Camera录像过程-- 数据流浅析
- 安全参透之旅大纲
- 面试问题
- Java 闭包机制
- C语言之 while循环和for循环
- IOS Animation动画基础
- unix环境高级编程中的例子-----递归降序遍历目录层次结构,并按文件类型计数
- 前端滚动字幕
- 使用C语言实现点菜系统
- 判定是否是正方形
- 跑起来 - 记录首马完赛
- 在linux下如何编译c程序和c++程序
- UIStepper 加减计步器
- 黑马程序员——面向对象(三)(多态和异常简述)