I'm really interested in this effect introduced in iOS 7 Camera app:
http://i41.tinypic.com/2a0hwk8.jpg
Notice, how "Pano" option is transformed - as if it is goes on a circular path to the right and dissappears. What kind of transformation can achieve this effect? Any help would be appreciated.
Thanks
It is probably a transform that is applied and adjusted when the view in question (the label) reaches a certain position (which would normally be done with KVO or similar).
However, a good place to start would be the iOS 7 picker view, which has a similar 3D effect, but in the vertical rather than the horizontal. They are probably achieved the same way, and the advantage with the picker is you can inspect its view hierarchy in your own apps.
Related
I'm implementing UI from dribble to practice my ability. Below images are original and my implementation.
I implemented almost, but I can't implement below side's shadow effect, how can do that?
My implementation is just stack two Card and move to left a bit. But I think it is not optimal solution, isn't it?
So my little solution for this one is just you need to build a stack witha container behind and a card in the front with some shadows to obtain this 3d Animation
I just wanted to implement slide-out menu like implemented in this snapshot below:
Could anybody guide me how to go for it.
Thanks
V#run
Looks like Patrick's link will give you most of what you want. If you really want the 3D look where the menu appears to be tilted away you'll have to learn how to use Core Animation with transformation matrixes that create perspective. Do a search on "Adding Perspective to Your Animations" in the Xcode help system for info on how to get perspective.
In short, it involves setting the M34 field of a CATransform3D to a small negative value after rotating the layer around the desired axis. (In this case you'd want to rotate around the y axis.)
RESideMenu is a great library that I've used more than once. You can find it on Github here: https://github.com/romaonthego/RESideMenu
I'm trying to recreate the barrel effect that can be seen on the camera mode picker below:
(source: androidnova.org)
Do I have to use OpenGL in order to achieve this effect? What is the best approach?
I found a great library on GitHub that can be used to achieve this effect (https://github.com/Ciechan/BCMeshTransformView), but unfortunately it doesn't support animation and is therefore not usable.
I bet Apple used CGMeshTransform. It's just like BCMeshTransform, except it is a private API and fully integrates with Core Graphics. BCMeshTransformView was born when a developer discovered this.
The only easy option I see is:
Use CALayer.transform, which is a CATransform3D. You can use this to simulate the barrel effect you want by adjusting the z position and y rotation of each item on the barrel. Also add a semitransparent dark gradient (CAGradientLayer) to the wheel to simulate the effect of choices getting darker towards the edges. This will be simple to do, but won't look as smooth and realistic as an actual 3D barrel. Maybe it will look good enough to create a convincing illusion though? (To enable 3D transforms, you need to enable depth by using view.layer.transform.m34 = 1/500.f or similar)
http://www.thinkandbuild.it/introduction-to-3d-drawing-in-core-animation-part-1/
The hardest option is using a custom OpenGL view that makes a barrel shape and applies your contents on top of it as a texture. I would expect that you run into most of the complexities behind creating BCMeshTransformView, and have difficulty supporting animations just like BCMeshTransformView did.
You may still be able to use BCMeshTransformView though. BCMeshTransformView is slow at processing content animations such as color changes, but is very fast at processing geometry changes. So you could use it to do a barrel effect, as long as you define the barrel effect entirely in terms of mesh geometry changes (instead of as content changes like using a scroll view or adjusting subview positions). You would need to do gesture handling + scrolling yourself instead of using UIScrollView though, which is tricky and tedious to get right.
Considering the options, I would want to fudge it by using 3D transforms, then move to other options only if I can't create a convincing illusion using 3D transforms.
Here is the result that I get:
If I set the doubleSided property of layer 4 as No, the whole layer disappears. I know that already. But then, how can I show yet with correct content orientation?
Do the animation in two parts. At the halfway point, when the layer is side-on to the camera so you can’t see it, flip the layer the other way around and move the anchor point to the other side, and swap out the contents of the layer if you need to.
Unfortunately, I don’t have any sample code, because the last time I did this was on iOS 4, and the pile of hacks view-based animations that I was using don’t appear to work on layers any more. You could post your own code and accept your own answer if you want.
I'm trying to build a native viewer for cubic panoramas. Here is a web version of what I would like to achieve: http://www.apple.com/html5/showcase/vr/
This type of projection works as follows: The panorama consists of 6 square images which are projected on the inner surface of a cube. The camera is positioned in the center of the cube.
Currently, I'm using 6 CALayers and arrange them in 3D space so that they form a cube. Rotating them works fine using CATransform3DMakeTranslation etc.
The problem is that CALayers are not transparent when seen from behind (they show the same image as the front side). This sucks, because the user can't see the projections inside the cube because the view is blocked by other layers of the cube.
Is there a solution for this problem? I could think of the following:
a.) Maybe there's a setting in Core Animation to make layers transparent when viewed from behind?
b.) Continuously track the current view direction and manually set the CALayers hidden which would block the view.
What would be the best solution to solve this?
You can simply try setting the doubleSided property to NO.