2013-03-12 15 views
8

CA ile basit bir şekilde flip animasyonu yapmaya çalışıyorum ama perspektifle ilgili bir problem yaşadım.Basit Çekirdek Animasyonlar UIView'nin 3D dönüşümü

[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 
}]; 

Bu nasıl güzel bir bakış açısı elde etmek: Birlikte çalıştığımız? Böyle

enter image description here

+1

Yinelenen soru? - http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview –

cevap

26

şey yapacağını:

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 
}]; 
+0

Neredeyse bu kadar, ama içeride değil dışarıda olması gerekiyor. Gri çizgi görüntü üzerine sabitlenir. – dormitkon

+0

m34 özelliği ile biraz oynadı, (1.0/-1000) ve şimdi güzel görünüyor :) thx – dormitkon