两朵飘动的小云
来源:互联网 发布:手机电子书阅读器软件 编辑:程序博客网 时间:2024/05/01 00:07
代码记录:
@interface ViewController (){
UIImageView * v1;
UIImageView * v2;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
//[self CloudAinimate];
[selfbgAnimate];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)bgAnimate {
if (v1==nil) {
v1 = [[UIImageViewalloc] initWithImage:[UIImageimageNamed: @"cloud"]];
v2 = [[UIImageViewalloc] initWithImage:[UIImageimageNamed: @"cloud2"]];
v1.alpha =v2.alpha =0;
v1.frame =CGRectMake(20, -275,1024, 520);
v2.frame =CGRectMake(120, -290,1024, 520);
[self.viewaddSubview:v1];
[self.viewaddSubview:v2];
}
NSLog(@"bganimate");
float t =32.0f;
[UIViewanimateWithDuration:4.0fdelay:0options:UIViewAnimationOptionCurveLinearanimations:^{
//淡入出现
v1.frame =CGRectMake(0, -280,1024, 520);
v2.frame =CGRectMake(-512+128, -300,1024, 520);
v1.transform =CGAffineTransformMakeScale(1.0,1.0);
v2.transform =CGAffineTransformMakeScale(1.0,1.0);
// v1.alpha = 0.2;
// v2.alpha = 0.2;
v1.alpha =0.8;
v2.alpha =0.8;
} completion:^(BOOL finished){
[UIViewanimateWithDuration:t delay:0options:UIViewAnimationOptionCurveLinearanimations:^{
//v1向放大快速右移动, v2缩小慢速
v1.frame =CGRectMake(-512, -350,1024, 520);
v2.frame =CGRectMake(-1204, -250,1024, 520);
v1.transform =CGAffineTransformMakeScale(1.2,1.2);
v2.transform =CGAffineTransformMakeScale(0.8,0.8);
// v1.alpha = 0.2;
// v2.alpha = 0.2;
v1.alpha =0.8;
v2.alpha =0.8;
} completion:^(BOOL finished){
v2.frame =CGRectMake(1024, -250,1024, 520);
[UIViewanimateWithDuration:t delay:0options:UIViewAnimationOptionCurveLinearanimations:^{
//v1向淡出, v2慢速
v1.frame =CGRectMake(-1024, -300,1024, 520);
v2.frame =CGRectMake(512-128, -350,1024, 520);
v1.transform =CGAffineTransformMakeScale(1.4,1.4);
v2.transform =CGAffineTransformMakeScale(1.0,1.0);
//v1.alpha = 0.1;
// v2.alpha = 0.15;
v1.alpha =0.5;
v2.alpha =0.55;
} completion:^(BOOL finished){
v1.frame =CGRectMake(1024, -350,1024, 520);
v1.transform =CGAffineTransformMakeScale(0.6,0.6);
[UIViewanimateWithDuration:t delay:0options:UIViewAnimationOptionCurveLinearanimations:^{
//v1向右侧进入, v2快速左侧移动
v1.frame =CGRectMake(512, -300,1024, 520);
v2.frame =CGRectMake(0, -300,1024, 520);
v1.transform =CGAffineTransformMakeScale(0.8,0.8);
v2.transform =CGAffineTransformMakeScale(1.2,1.2);
// v1.alpha = 0.15;
// v2.alpha = 0.1;
v1.alpha =0.5;
v2.alpha =0.55;
} completion:^(BOOL finished){
[UIViewanimateWithDuration:t delay:0options:UIViewAnimationOptionCurveLinearanimations:^{
//v1向右侧进入, v2快速左侧移动
v1.frame =CGRectMake(20, -250,1024, 520);
v2.frame =CGRectMake(-512+108, -350,1024, 520);
v1.transform =CGAffineTransformMakeScale(0.9,0.9);
v2.transform =CGAffineTransformMakeScale(1.1,1.1);
// v1.alpha = 0.2;
//v2.alpha = 0.1;
v1.alpha =0.8;
v2.alpha =0.4;
} completion:^(BOOL finished){
// if (__userToken) return;
}];
}];
}];
}];
}];
}
-(void)CloudAinimate
{
if (v1==nil) {
v1 = [[UIImageViewalloc] initWithImage:[UIImageimageNamed:@"cloud.png"]];
v2 = [[UIImageViewalloc] initWithImage:[UIImageimageNamed:@"cloud2.png"]];
v1.alpha =v2.alpha =0;
v1.frame =CGRectMake(0,0, 500,300);
v2.frame =CGRectMake(0,0, 500,400);
[self.viewaddSubview:v1];
[self.viewaddSubview:v2];
[UIViewanimateWithDuration:4.0fdelay:0options:UIViewAnimationOptionCurveLinearanimations:^{
v1.alpha =1;
v2.alpha =1;
} completion:^(BOOL finished){
}];
}
v1.alpha =1;
v2.alpha =1;
NSLog(@"CloudAinimate");
[UIViewanimateWithDuration:40.0fdelay:0options:UIViewAnimationOptionCurveLinearanimations:^{
//淡入出现
CGRect t =v1.frame;
if( t.origin.x ==0 )
{
v1.frame =CGRectMake(-1024,300, 1024,768);
v2.frame =CGRectMake(0,300, 1024,768);
}
else
{
v1.frame =CGRectMake(0,300, 1024,768);
v2.frame =CGRectMake(-1024,300, 1024,768);
}
}completion:^(BOOL finished)
{
CGRect t =v1.frame;
if(t.origin.x == -1024 )
{
v1.frame =CGRectMake(1024,300, 1024,768);
}
else
{
v2.frame =CGRectMake(1024,300, 1024,768);
}
}];
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
- 两朵飘动的小云
- 花开两朵 天各一方
- BI与全面预算:制造业春天的两朵奇葩
- 飘动的红旗
- 飘动的椭圆
- OpenGL 飘动的旗
- 飘动的文字
- 飘动的旗
- 谁才是“用户觉得”最快的那朵云?
- ofo小黄车进哈佛幕后:一朵“日不落”的阿里云
- 飘动的字符跟随鼠标
- JS的飘动窗口特效
- oepngl飘动的旗帜(正弦)
- 跟随鼠标飘动的图片
- OpenGL -- 飘动的旗帜 (java)
- OpenGL -- 飘动的旗帜 (java)
- 丛林小英雄迪亚哥 Go Diego Go 14张DVD,朵拉的表兄弟
- 一朵白莲的九生九世
- Java中导入、导出Excel
- PhpStorm的常用快捷键
- C语言学习-分支结构 (简单明了)
- layer弹窗iframe页面,关闭弹窗方法导致form表单无法提交到服务器
- overflow滚动条样式调整
- 两朵飘动的小云
- Shell Exit command
- poj 1064 cable master
- ActionListener KeyListener
- java 变量与常量
- 支付,流程
- webGL第八课-绘制一个三维图形
- Linux 七个运行级别
- 使用元数据设计测试用例