我如何在iOS上制作爆炸动画?

Bla*_*end 3 iphone core-animation ios

我有一个iOS游戏,当一个球击中目标时会爆炸.

什么是动画爆炸的最佳方式?

NWC*_*der 5

如果你正在寻找简单的东西.

制作一系列使爆炸生动的图像.将它们添加到UIImageView并启动动画.像这样的东西:

UIImage *image0 = [UIImage imageNamed:@"explosion0.png"];
UIImage *image1 = [UIImage imageNamed:@"explosion1.png"];
UIImage *image2 = [UIImage imageNamed:@"explosion2.png"];
UIImage *image3 = [UIImage imageNamed:@"explosion3.png"];

myImageView.animationImages = [NSArray arrayWithObjects:image0, image1, image2, image3, nil];
[myImageView setAnimationDuration:0.75f];

[myImageView startAnimation];
Run Code Online (Sandbox Code Playgroud)