问题标签 [catransform3d]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1488 浏览

macos - 为什么 CATransform3DMakeRotation 不采用 (0,0,1) 作为绕 Z 轴旋转?

如果我NSView在 Cocoa 的应用程序中进行转换:

我看到正方形没有绕 Z 轴旋转,而是像该矢量向下和向外一样旋转。我需要成功

使其绕Z轴旋转,如本题图片所示。

但是,如果我设置一个NSTimer然后更新方法transform中的update,然后使用

(这一次,使用(0, 0, 1))将起作用:它围绕 Z 轴旋转。我想知道为什么(1, 1, 1)需要 inside applicationDidFinishLaunching,但(0, 0, 1)可以在update方法中使用?

0 投票
1 回答
757 浏览

iphone - CATransform3D not working properly

CATransform3D not working properly, I am using the below code. My problem is If I change the transform Its working fine. Once I release my finger and then make more transform the image goes to the Initial image. How to set the last transform? I am using PanGesture for the transform. Please give some Idea. Thanks in advance.

0 投票
0 回答
186 浏览

cocoa - 使用 [NSValue valueWithCATransform3D: ] 创建 Transformable 属性时需要帮助调试 _encodeObject 中的异常

我正在尝试将 CATransform3D 保存在核心数据存储中。在我的自定义 NSObject 子类中,我使用:

将输入 CATransform3D 转换为 NSValue。NSLog 显示了预期的转换:

从我读过的所有 NSValue 中,通过实现 NSCoding(通过 NSSecureCoding),当在模型中指定为 Transformable 时应该是可存储的。但是,在写信给商店时,我得到了异常:

[NSKeyedArchiver encodeValueOfObjCType:at:]:这个归档器不能编码结构

我还有其他 CIColor 类型的 Transformable 属性似乎工作正常。

我确信还有许多其他方法可以存储 CATransform3D 属性,但我想了解这里不起作用的地方,以避免遇到类似情况。

对于它的价值,此时商店设置为默认二进制文件,但这在我看来并不取决于商店类型。

我错过了什么吗,这是一个已知的错误,还是其他什么?

0 投票
3 回答
3814 浏览

ios - 自动布局旋转轮

我正在尝试使用 CGAffineTransformRotate 旋转 UIImageView 约束,但视图在旋转时会抖动。如果我使用 CATransform3DRotate 旋转它的图层,这不会发生,但是一旦我编辑约束(更改常量),旋转的图像就会跳开。有没有人知道如何解决这个问题?

这是跳开的旋转图像的截图在此处输入图像描述

0 投票
1 回答
951 浏览

ios - 书皮翻转动画ios

我正在尝试了解如何在 ios 中打开和关闭书皮动画。谷歌搜索结果如下:

它工作得很好,但我发现很难理解它是如何完成 CATransform3DMakeRotation 的。如果您遇到任何方向或资源,请告诉我。我的主要动机是找到一种方法来扭转行动(合上书的封面)。我曾尝试更改代码,但没有奏效。提前致谢。

0 投票
2 回答
948 浏览

objective-c - 旋转图像保留中心?

我有这个示例图片

在此处输入图像描述

当我旋转时,我需要挡住圆圈中间的中心。
锚点是什么?是锚点的问题吗?

现在图像旋转,不考虑锚点。

我需要做一个测试,比如从 0 到 300 的逆时针,保留中心。

0,箭头到底部
150,箭头到顶部
300,箭头到底部
等...

谢谢。

0 投票
1 回答
775 浏览

catransform3d - 将 CALayers 组合并翻转为 CATransformLayer 的子视图

根据较早的stackoverflow 建议,我正在尝试使用添加到CATransformLayer 的CALayers 创建一张扑克牌。这个想法是创建前后 CALayer 并将它们组合在 CATransformLayer 中,然后可以旋转、翻转等,并自动显示正确的一面。下面是尝试创建一张正面为绿色,背面为红色的单张卡片的示例代码。

红色背面围绕 Y 轴翻转,使其背对绿色正面。绿色前面的 calayer 比红色后面的 Z 位置“更高”。

但是,当我进行转换时,我只是看到卡片似乎处于未翻转状态。有什么想法我在这里出错了吗?

0 投票
2 回答
229 浏览

objective-c - 像平衡板一样的旋转线

好吧,
我在照片中有一个这样的圆圈。
我想将我的红线旋转到我想要的程度。

圆从 0 到 300 度开始。

我开始做一些事情

但在这个片段中,0 值在顶部,而不是在底部。
可能是因为我不是三角学天才...... :)

在此处输入图像描述

正确旋转箭头的正确方法是什么?
角度值如何设置?

谢谢。

0 投票
1 回答
345 浏览

iphone - Screenshot of iCarousel/CATransform3D in iOS

so the former approach using the undocumented API UIGetScreenImage is no longer accepted by Apple ( Blog-post on UIGetScreenImage ).

The recommended CALayer renderInContext approach doesn't work with 3D Animations as used in iCarousel.

Is there any currently allowed method of getting my iCarousel/CATransform3D-formed view into an UIImage? Maybe is there a conversion from CATransform3D to CGAffineTransform (I know that this is generally not possible to, since CATransform3D has more dimensions, yet in the special case of the typical iCarousel, the full 3D-ness of CATransform3D isn't used)

0 投票
0 回答
617 浏览

uiview - 在 Y 和 Z 方向上倾斜 UIView

我的图形是这样的,为了使我的视图内容与图形正确对齐,它需要深度旋转,即沿 z 轴旋转。可能沿 z 方向 5-10 度,沿 y 方向负 5-10 度。

目前我使用这个:(argView是我的imageview)

然而,这给了我非常扭曲的形象——绝对不是我想要的,但我不知道我应该在那里提供什么。

我从阅读苹果文档开始,但是有太多的功能让我感到困惑。如果有人有任何好的指南可以让我很容易,那就太好了。如果有人能指出这件事在哪里完成,那就更好了。