Comment faire pivoter un UIImageView avec CATransform3DRotate faire un effet comme ouverture de porte?
J'ai lu et essayer ce l'article (l'Ouverture de la porte à l'aide de Core Animation)
Et j'en œuvre code suivant dans mon application:
CALayer *layer = threeHomeView.layer;
CATransform3D initialTransform = threeHomeView.layer.transform;
initialTransform.m34 = 1.0 / -900;
[UIView beginAnimations:@"Scale" context:nil];
[UIView setAnimationDuration:3];
layer.transform = initialTransform;
CATransform3D rotationAndPerspectiveTransform = threeHomeView.layer.transform;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform
, 40.0f * M_PI / 180.0f
, 0.0f
, 1.0f
, 0.0f);
layer.transform = rotationAndPerspectiveTransform;
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(threeHomeFlyOut)];
[UIView commitAnimations];
threeHomeView est une UIImageView.
MA QUESTION EST: l'image ne peut tourner par le milieu de la ligne verticale de l'image, mais je veux tourner par la gauche de la ligne verticale de l'image.
source d'informationauteur ZYiOS
Vous devez vous connecter pour publier un commentaire.
Utilisation
CATransform3DRotate
comme vous l'avez fait en combinaison avecCATransform3DTranslate
à tourner autour du bord, comme je l'ai fait dans cette réponse. Voici un petit extrait (vous devrez modifier ce pour votre propre usage):