2016-08-31 9 views
1

UIImageViewsにアニメーションを適用したいです。このアイデアは、画像1を水平に90度反転させ、次に画像2を回転して回転させることです。ヘッド側(画像1)が前方を向いている→90度回転→テール側(画像2)が正面を向くように回転します。私はアニメーションの最初の半分を行うことができますが、私は秒で立ち往生しています。アニメーションをひっくり返すためUIImageview回転アニメーション

[UIView animateWithDuration:1.0f animations:^{ 
    image1.transform = CGAffineTransformMakeScale(-0.01, 1); 
} completion: ^(BOOL finished) { 
    // How can I make image 2 to rotate out as if it initially was already rotated by 90 degrees? 
}]; 
+0

は、最初の1が完了したブロック内別animateWithDurationブロックを追加してみてください – Arun

答えて

0

、アニメーションオプションは、他のアニメーションオプションはFromLeftのように、また、そこにある

[UIView transitionWithView:myImageView //with first image 
        duration:animationDuration 
        options:UIViewAnimationOptionTransitionFlipFromRight 
       animations:^{ 
        myImageView.image = toImage; //to next image 
       } completion:^(BOOL finished) { 
      //completion actions after flipped 
}]; 

例えばのような以下の、例えばUIView'sアニメーション方法でそれを使用し、UIViewAnimationOptionTransitionFlipFromRightが呼ばれます FromTopFromBottomあなたの要件にいずれかを使用してください

0

この質問を見てみましょうg CATransform3Dを使用した3DでのUIView。

Simple Core Animations 3D transform of UIView

答え:

CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; 
rotationAndPerspectiveTransform.m34 = 1.0/-1000.0; 
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, M_PI * 0.6, 1.0f, 0.0f, 0.0f); 
[UIView animateWithDuration:1.0 animations:^{ 
    self.someView.layer.anchorPoint = CGPointMake(0.5, 0); 
    self.someView.layer.transform = rotationAndPerspectiveTransform; 
} completion:^(BOOL finished){ 
    // code to be executed when flip is completed 
}]; 
関連する問題