2009-08-04 8 views
0

iPhoneでイージング機能を実装するためのサンプルコードを探しています。 UIImageViewでアニメーション化された一連の画像があります。iPhone用イージング関数(サンプルコード)を実装しているアプリケーション

私がしたいことは、それらをバウンスのように見せるためにいくつかの簡単な機能を使用することです。

たとえば、クリックすると、バルーンは以前のサイズからカーブで大きくなります。

などはサイズ50×50のは100X100になるから言うことができますが、アニメーションしながら、それはまた、120X120になり、100X100

TNX

+0

イメージが収縮したときにバウンス効果を得ようとしているのは正確です。 – Daniel

+0

イメージが元のサイズに達すると、バウンス効果が得られます。私が50から100まで言ったように、それは120になり、100に戻ります。 – rkb

+0

可能な複製:http://stackoverflow.com/questions/5161465/how-to-create-custom-easing-function-with-core-アニメーション –

答えて

0

その男に簡単な方法はありませんに戻ってくる:Pは

I

//getting image 
UIImageView *newImageView = [[UIImageView alloc] initWithImage:@"yourtargetimage.png"]; 
//Setting the initial size of image to 0.01 (invisible) 
[newImageView setTransform:CGAffineTransformMakeScale(0.01, 0.01)]; 

[UIImageView beginAnimations:nil context:newImageView]; 
      [UIImageView setAnimationDuration:0.25]; 
      [UIImageView setAnimationDelegate:self]; 
      [UIImageView setAnimationDidStopSelector:@selector(bounceBackButton:finished:context:)]; 

      [UIImageView setAnimationDelay:0.2*count]; 
      CGAffineTransform transformGrow = CGAffineTransformMakeScale(1.2, 1.2); 
      newImageView.transform = transformGrow; 
      [UIView commitAnimations]; 


- (void)bounceBackButton:(NSString *)animationID finished:(NSNumber *)finished context:(UIImageView *)imagesHolder 
{ 
    [UIImageView beginAnimations:nil context:imagesHolder]; 
    [UIImageView setAnimationDuration:0.15]; 
    [UIImageView setAnimationDelegate:self]; 
    CGAffineTransform transformBack = CGAffineTransformMakeScale(1.0, 1.0); 
    imagesHolder.transform = transformBack; 
    [UIView commitAnimations]; 
} 

は、アニメーションの一つの配列を使用する:これも1時間を探して、私はそれを行うために、1つの作品の周りにい

あなたは初期ア​​ニメーション状態を設定し、目標サイズ+ 1ボースに移動し、1.0の状態に戻る必要があります。

関連する問題