What is the difference between animating Constraints or Transform? - ios

I'm creating a rather complex animation, using UIViewPropertyAnimator, where I have the need to make precise movements like this one:
I was wondering what's the difference if I achieve this while animating the constraints, or animating the transform?
I achieved, what you see in the gif, using transform animations. But I got curious, and I got few more screens like this to animate so I wanted to know if there is a preferred way, or any 'animation rules'.
I'm mostly curious if there is a performance difference, but I'd also like to hear if someone got stuck using one of the mentioned ways.

Related

Rotate UIView in place when orientation changes

Briefly, I want to properly use autolayout (and maybe size classes) to get a column of UIViews to rotate in place when the orientation changes. I can get the correct before and after looks (see images) using a UIStackView, but the transition is not what I want: each little image-label combination should rotate individually. I have tried embedding the image-label pair in a wrapper view, setting constraints in various plausible and implausible combinations... going crazy. Would prefer to use IB as much as possible, but willing to go to programmatical if necessary.
It's so easy to visualize this that one thinks it should be comparably easy to implement. I know enough linear algebra to do it all by hand, but really can't I stand on some tall shoulders?

How to do animation using autolayout in ease in ease out fashion for all screen sizes of iOS?

Using autolayout how can I do animation like ease in, ease out. Should I switch to core-animation for this.
For animation using constraints I understood from this link How do I animate constraint changes?
But they are not talking about animating like this.
How would I do animation like this, or in a bezier path using bezier function which would look good in all iOS sizes of screens . I searched a lot but I am missing this answer for a long time. A standard practise of doing ease in ease out or along a bezier path using autolayout . I understand there is a workaround but again asking for the standard practise?

2D animation of bitmaps in objective-c on iOS - How do I get best performance?

I have a few moving bitmaps on the screen and the animation is not smooth. I am using UIImageViews and animateWithDuration.
What can I do to increase the performance? are there any guidelines that I should follow? Do I need a different approach, like use CGLayer or openGL? if so, can you point me to some starting article/tutorial?
thanks,
Nimrod
You should consider using CALayer for this:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004514
If that still is not enough, you may want to use cocos2d. It may seem like overkill, but it is rather easy to do 2D animation with it:
http://www.cocos2d-iphone.org

iPhone-Move UI Image view along a Bezier curve path

I want o move the UIImageView along a Bezier path, can anybody point me towards from where i can learn and achieve it.
An exact answer to that is probably very hard to do. But you may get close to what you want by using two CALayers, one a sublayer of the other. Put a x-translation animation on the one layer, and an y-translation animation on the other. Then experiment with custom animation timing functions for each of the translations.
See Animations Types and Timing Programming Guide

UIView animation vs CALayers

I'm struggling with conceptualizing animations with a CALayer as opposed to UIView's own animation methods. Throw "Core Animation" into this and, well, maybe someone can articulate these concepts from a high level so I can better visualize what's happening and why I'd want to migrate UIView animations (which I'm quite familiar with now) to CALayer animations on the iPhone. Every view in Cocoa-Touch automatically gets a layer. And, it seems, you can animate one and/or the other?!? Even mix them together?!? But why? Where's the line? What's the pro/con to each?
The Core Animation Programming Guide immediately jumps into Layer & Timing Classes and I think need to take a step back and understand why these varied pieces exist and how relate to each other.
Use views for control and layers for eye candy. Layers don't receive events so it's easier to use a view for those cases, but when you want to animate a sprite or backgrounds, etc., layers make sense. Events pass right through layers to the backing view so you can have a pretty visual representation without messing up your events. Try to overlay a view that you're just using for visual representation and you'll have to pass tap events through to the underlying view yourself.
An UIView is always rendered to a CALayer. When you use UIView methods to animate a view, you are effectively manipulating the underlying CALayer.
If you need to do simple things, use the UIView methods. For more complex situatins, or if you want layers not associated with any view in particular, use CALayers.
I've done a bunch of apps in the past year. Here's my rule of thumb:
Use UIView until it doesn't do what you want.
Then move to CoreAnimation. But before you get into it too much...
If you write more than a few animations, use Cocos2D.
UIView transforms are only 2D and are restricted to that, LAyer transforms however can be 3D and you should use those if you want to do 3D stuff, UIView animation will work if you change either the UIView transform or the CALayer transform. So at a basic level, you can do a lot more manipulation when you are working with a Layer rather than the View.
I am not sure if I am misunderstanding Chris' response to "What's Cocos2D doing better? Don't you have other problems then, regarding the touch event handling and many other stuff that misses in openGL ES?"
It sounds like the answer suggests Cocos2D is not based on the OpenGL ES framework when in fact it actual is. While it is a great 2D game engine it does implement OpenGL for much of it's rendering - attached to a physics library it allows for a lot of very interesting possibilities for animation - and Chris is correct - it is a lot less coding indeed.

Resources