基本上,我试图模拟一个从小开始但逐渐扩大直到它占据整个屏幕的爆炸。
-(void)Dying{
[BirdMovement invalidate];
[TunnelMovement invalidate];
[TunnelMovement2 invalidate];
[TunnelMovement3 invalidate];
[TunnelMovement4 invalidate];
[BirdMovement_orange invalidate];
[BirdMovement_yellow invalidate];
[BirdMovement_green invalidate];
[BirdMovement_blue invalidate];
[self.window makeKeyAndVisible];
Bird.frame=CGRectMake(Bird.center.x,Bird.center.y,23,37);
Bird.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"Explode1.png"],
[UIImage imageNamed:@"Explode2.png"],
[UIImage imageNamed:@"Explode3.png"],
[UIImage imageNamed:@"Explode4.png"]
, nil];
Bird.animationDuration = 3;
Bird.animationRepeatCount = 1;
[Bird startAnimating];
[self.window addSubview:Bird];
[self performSelector:@selector(Dead) withObject:nil afterDelay:2.0];
}
-(void)Dead{
[Bird stopAnimating];
[self GameOver];
}
我尝试弄乱CGRectMake
说
[Bird.frame=CGRectMake(Bird.center.x,Bird.center.y,23 +5 ,37 +5);]
但显然这不会起作用,因为它只是制造它(28,42)。
答案 0 :(得分:0)
这会将您的imageView动画设置为3秒以上的新尺寸。
UIImageView * bird = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
bird.animationImages = @[
[UIImage imageNamed:@"bird1"],
[UIImage imageNamed:@"bird2"],
[UIImage imageNamed:@"bird3"],
[UIImage imageNamed:@"bird4"],
[UIImage imageNamed:@"bird5"]
];
[self.view addSubview:bird];
[bird startAnimating];
[UIView animateWithDuration:2 animations:^{
bird.frame = CGRectMake(0, 0, 200, 200);
}];