catransform3d

CATransform3D rotate causes half of image to disappear

拥有回忆 提交于 2019-12-03 15:04:12
问题 I'm using the following code to rotate an image, but half the image (down the y-axis) that has been rotated "out of" the page, disappears. How to fix? heading is in radians. CALayer *layer = myUIImageView.layer; CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; rotationAndPerspectiveTransform.m34 = 1.0 / 500; rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, heading, 0.0f, 1.0f, 0.0f); layer.transform = rotationAndPerspectiveTransform;

How do I use CATransform3D on a UIView to add a specific type of perspective?

 ̄綄美尐妖づ 提交于 2019-12-03 07:52:08
I've been creating iPhone apps for a while now, using basic transformations (rotations, scale, etc) but now I'd like to do something a little more complex. Maths really isn't my strongest point... but I was wondering how I might go about adding 'perspective' to a UIView (see the image below). I quickly mocked the screenshot up using skew options in Photoshop . I have had a look around stackoverflow for solutions to this, I found How do I apply a perspective transform to a UIView? which works excellently - but it's not really what i'm after because the height of the left most edge is larger

“renderInContext:” and CATransform3D

左心房为你撑大大i 提交于 2019-12-03 00:46:00
I have an view that have mutiples views inside it, and an image presentation (aka. 'cover flow') into that too... And I need to make a screenshot programatically ! Since docs says that "renderInContext:" will not render 3d animations : "Important The Mac OS X v10.5 implementation of this method does not support the entire Core Animation composition model. QCCompositionLayer, CAOpenGLLayer, and QTMovieLayer layers are not rendered. Additionally, layers that use 3D transforms are not rendered, nor are layers that specify backgroundFilters, filters, compositingFilter, or a mask values. Future

On iOS, why does setting a layer's sublayerTransform turn itself to act like CATranformLayer?

◇◆丶佛笑我妖孽 提交于 2019-12-03 00:31:23
It is known that the zPosition of the layers only determines which layer cover up which layer. Whether it is a zPosition of 10 or 1000 won't affect its position. That is, unless if we use CATransformLayer to contain those layers , then the zPosition of those layers will affect the layers' position. However, the following code running in iOS 5.1.1 does make the zPosition alter the position of the layers... you can try it in a new Single View App, and add the following code to ViewController.m . If the zPosition of layer2 is changed from 88 to 188 , we can see that the layer moves accordingly.

Need better and simpler understanding of CATransform3D

我们两清 提交于 2019-12-02 14:56:07
Please go through the images. So this is the code which I got from some online source and it does transform my object. Besides that, I understood nothing at all. I am new to CATransform3D and want to know exactly how it works. CATransform3D transform = CATransform3DIdentity; transform.m34 = 1.0 / -500; transform = CATransform3DRotate(transform, 45.0f * M_PI / 180.0f, 0, 1, 0.0f); _bgView.layer.transform = transform; I want to know how did this code run? Why did we set some value in m34? I found that its some kind of matrix which even confuses me more. Also, what do the arguments in the

Could I get a basic explanation of CATransform3DIdentity?

岁酱吖の 提交于 2019-11-30 20:10:02
I am slowly getting more serious about Core Animation and would greatly appreciate an explanation composed of short words spoken (typed?) slowly explaining CATransform3DIdentity and why the following code does what it does (flips the layer around in '3D' space) kFaceUpTransform = kFaceDownTransform = CATransform3DIdentity; // Construct a 180-degree rotation matrix: kFaceDownTransform.m11 = kFaceDownTransform.m33 = -1; On second thought, type quickly and use multisyllabic words to your hearts content but please be gentle. PS. I get the impression that I should become much more comfortable with

iOS核心动画笔记5-变换

﹥>﹥吖頭↗ 提交于 2019-11-30 12:34:14
变换 这一节主要讲的是, 对图层进行旋转,缩放扭曲等操作. 1. 仿射变换 在视图层面上, UIView有个属性叫做 transform, 可以进行二维层面上的图层变换. 主要包括: 旋转/平移/缩放操作. 当图层应用变换矩阵进行变换时候, 图层矩形内的每个点都会被相应的进行变化, 从而形成一个新的四边形的形状. 仿射变换中"仿射"的意思是无论变换矩阵用什么值, 图层中平行的两条线在变换之后仍然保持平行. 2. 创建仿射变换 CGAffineTransform CGAffineTransform实际上是一个3*2的矩阵, 在OC中用结构体表示, (CG前缀表示属于Core Graphcs框架), CG框架提供了方便的方法来创建CGAffineTransform结构体, 如下三个是创建旋转, 缩放,平移的方法, 返回值是CGAffineTransform类型结构体. CGAffineTransformMakeRotation(CGFloat angle) CGAffineTransformMakeScale(CGFloat sx, CGFloat sy) CGAffineTransformMakeTranslation(CGFloat tx, CGFloat ty) UIView用来做变换的属性叫做transform, 对应CALayer的属性是affineTransform.

3D Door Open Animation between two UIViewControllers

风流意气都作罢 提交于 2019-11-30 05:48:51
This has been asked before, but there is no sample code to be found on stackoverflow and no proper solutions as far as I'm aware. I have a solution, but it looks crap. I'd be grateful for any input and modifications to get a more realistic 3D door open / book cover animation. Aim is to have an animation between UIViewControllers so that you get the effect as if you were opening a door or a book cover. ViewController 2 is static and in the background. Above it you place ViewController 1 which covers ViewController 2. The animation will open ViewController 1 (like a hardcover book) and reveal

iOS: Simultaneous scale and 3D rotation animation

做~自己de王妃 提交于 2019-11-30 04:14:19
I made a video demonstrating the animation i'm trying to accomplish: Here it is. Notice the video illustrates the action as it would be seen from the side. The camera icon represents the user's POV. It's basically a simulation of a translation among the Z-axis accomplished though a scale transform, with a simultaneous independent two-step 3D rotation happening along the X axis. Looks and sounds simple enough, right? Wrong. Here's the ideal code, which doesn't work: [UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ view.transform =

meaning of m34 of CATransform3D

ε祈祈猫儿з 提交于 2019-11-29 21:05:11
What's the meaning of m34 of the structure CATransform3D, I only know it can change the perspective, but what's the meaning when the value is -0.001 and 0.001? You can find the full details here . Note that Apple uses the reversed multiplication order for projection (relative to the given link) so all matrix multiplications are reversed and all matrices are transposed. A short description of the meaning: m34 = 1/z distance to projection plane (the 1/e z term in the reference link) + for the z axis is towards the viewer, resulting in a "looking in the mirror" feel when using - projection center