开发者

Rotate 3D got issue in X axis

开发者 https://www.devze.com 2023-04-01 01:19 出处:网络
I have rotate3d one image.. Here is my code.. CALayer *layer = backImageView.layer; CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;

I have rotate3d one image.. Here is my code..

CALayer *layer = backImageView.layer;
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = 1.0 / -300;
rotationAnd开发者_开发知识库PerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 15.0f * M_PI / 180.0f, 1.0f, 0.0f, 0.0f);
layer.transform = rotationAndPerspectiveTransform;

As before putting background image looks like

Rotate 3D got issue in X axis

After

But when i put one more image as a background it looks like this..

Rotate 3D got issue in X axis

X(-ve) - axis should not be displayed..

Is there any thing wrong in code or need to add extra logic or code ?

Thanks..


I had the same problem. Its happens becouse before rotation both images lay in the same plane, but after rotation part of the image appears behind the plane and covered by another. My solution was to drag one of the images on another plane, so they do not overlap.

grayImage.layer.transform=CATransform3DMakeTranslation(0, 0, -100);

Where grayImage your second image.

0

精彩评论

暂无评论...
验证码 换一张
取 消