且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-01-02 22:04:34

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

If you're looking for something simple.

制作一系列动画来爆炸.将它们添加到UIImageView并开始动画.像这样:

Make a series of images that animate the explosion. Add those to a UIImageView and start the animation. Something like this:

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];