私は非常に初心者のプログラマーで、これを行う最も簡単な方法を見つけようとしています。私はこれまでアニメーションで何もしたことがありません。アプリで画像をアニメーション化したいのですが、いくつか問題が発生しました。これは、誰かが以前に私が使用することを提案したコードです(別の質問から):
imageView.image = yourLastImage;
// Do this first so that after the animation is complete the image view till show your last image.
NSArray * imageArray = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"],
[UIImage imageNamed:@"image3.png"],
[UIImage imageNamed:@"image4.png"],
nil];
// Note: here you may instead want to use something like [UIImage imageWithContentsOfFile:[self localImagePath:NO]] instead depending upon your targeted iOS version.
UIImageView * animatedImageView = [[UIImageView alloc] initWithFrame:
CGRectMake(100, 125, 150, 130)];
animatedImageView.animationImages = imageArray;
animatedImageView.animationDuration = 1.1;
myAnimation.animationRepeatCount = 1;
animatedImageView.contentMode = UIViewContentModeBottomLeft;
[self.view addSubview:animatedImageView];
[animatedImageView startAnimating];
さて、まず、これは実用的ですか?画面の中央から画面の下部に移動するものをアニメーション化したいと考えています。それは、互いに 1 ピクセルずつ離れた 500 枚の画像を用意する必要があるということですか? 滑らかで均一に見え、大量の作業を必要としない最適なピクセル間隔はどれくらいですか? 上記の方法よりもアニメーション化するためのより良い方法はありますか? 後で Xcode に追加できるアニメーションを作成するのに役立つプログラムはありますか?
また、誰かが上記のコードを説明してもらえますか? アニメ初心者で意味がよくわかりません。
ばかげた質問で申し訳ありませんが、冒頭で私は初心者だと言いました。ご協力いただきありがとうございます。