15

CAで単純な部分反転アニメーションを作ろうとしているのですが、遠近感に問題がありました。私は試しました:

    [UIView animateWithDuration:1.0 animations:^{
    self.someView.layer.anchorPoint = CGPointMake(0.5, 0);
    self.someView.layer.transform = CATransform3DMakeRotation(M_PI*0.6,1.0,0.0,0.0);
} completion:^(BOOL finished){
    // code to be executed when flip is completed
}];

この素晴らしい視点を得るにはどうすればよいですか?

ここに画像の説明を入力

4

2 に答える 2

32

次のようなことができます:

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
}];
于 2013-03-12T23:46:01.483 に答える
1

パースペクティブ変換を UIView に適用するにはどうすればよいですか?

問題の回答を参照してください。

基本的に、オブジェクトが背景にどれだけ縮小するかを制御するマトリックスの m34 を変更します。

もっと興味がある場合は、http: //www.songho.ca/opengl/gl_projectionmatrix.htmlをチェックしてください。

于 2013-03-12T23:46:31.803 に答える