sách gpt4 ai đã đi

uiview - 了解 CATransform3D

In lại 作者:行者123 更新时间:2023-12-04 15:15:21 29 4
mua khóa gpt4 Nike

我正在 UIView 中使用 CATransform3DMakeRotation,并且我正在尝试进行 45º,变换就像向后放置一样:

http://cl.ly/2A2p1W1e2N3a1W181r35

这是我拥有的“代码”,但显然没有这样做。

CATransform3D _tr = CATransform3DMakeRotation(3.14/4, 1, 0, 0);
view.layer.transform = _tr;

请帮助我理解参数。
Cảm ơn.

1 Câu trả lời

基本上,你的代码是正确的,但要获得透视效果,你需要设置sublayerTransform super View 的层是这样的:

CATransform3D perspectiveTransform = CATransform3DIdentity;
perspectiveTransform.m34 = 1.0 / -850;
myView.layer.sublayerTransform = perspectiveTransform;

您可以针对不同的失真量尝试不同的值。

关于uiview - 了解 CATransform3D,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6887786/

29 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com