「CoreAnimationでの3D回転とPerspective表示」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
CoreAnimationを使ってUIViewを回転させるとき、3D回転や表示をさせるためには、
下の例のように、Rotateしたあとに、別のRotateとはConcatする必要がある。
また、Perspective表示にする場合には.m34の設定をおこなう。
// コンパスアイコンの回転(3Dパースペクティブ)
CATransform3D commpassTransform = CATransform3DIdentity;
commpassTransform = CATransform3DRotate(commpassTransform, -M_PI*magHeading/180.0, 0, 0, 1);
commpassTransform = CATransform3DConcat(commpassTransform, CATransform3DMakeRotation(M_PI*50.0/180.0, 1, 0, 0));
CATransform3D perspective = CATransform3DIdentity;
perspective.m34 = 1.0 / -80;
commpassTransform = CATransform3DConcat(commpassTransform, perspective);
compassView.layer.transform = commpassTransform;