Open phamsontm9x opened 6 years ago
I have some document about Animation. Follow the link below if you're interested. Have a good night ^^! https://drive.google.com/open?id=1QQKm4u524iyKgq8i-kJPtlKJalVNxvYy
Great man, thank you for sharing, have a sound sleep :))
On Tue, 24 Jul 2018 at 22:24, Thanh Sơn notifications@github.com wrote:
I have some document about Animation. Follow the link below if you're interested. Have a good night ^^! [(https://drive.google.com/open?id=1QQKm4u524iyKgq8i-kJPtlKJalVNxvYy)]
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kieuquangloc147/iOSAnimation/issues/1#issuecomment-407447109, or mute the thread https://github.com/notifications/unsubscribe-auth/AHxWoKETsxzZCSVfeshXV-ug9fM8U9Myks5uJzw_gaJpZM4Vc8_C .
Core Animation (Layer Animations)
1. CAAnimation CAAnimation provides the basic support for the CAMediaTiming and CAAction protocols. You do not create instance of CAAnimation: to animate Core Animation layers or SceneKit objects, create instances of the concrete subclasses CABasicAnimation, CAKeyframeAnimation, CAAnimationGroup, or CATransition. 
a. CAPropertyAnimation:
* An abstract subclass of CAAnimation for creating animations that manipulate the value of layer properties.
b. CABasicAnimation:
c. CAKeyframeAnimation:
2. Animation Groups
a. CAAnimationGroup:
An object that allows multiple animations to be grouped and run concurrently. If you want to apply multiple animations to a layer object simultaneously, you can group them together using a CAAnimationGroup object. Using a group object simplifies the management of multiple animation objects by providing a single configuration point. Timing and duration values applied to the group override those same values in the individual animation objects. For example below the link: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreAnimation_guide/CreatingBasicAnimations/CreatingBasicAnimations.html
b. CATransaction
CATransaction is the Core Animation mechanism for batching multiple layer-tree operations into atomic updates to the render tree. Every modification to a layer tree must be part of a transaction. Nested transactions are supported. Advanced CATransition Tricks : https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreAnimation_guide/AdvancedAnimationTricks/AdvancedAnimationTricks.html#//apple_ref/doc/uid/TP40004514-CH8-SW1
3. Animation time
Layer Basics
Layer objects are 2D surfaces organized in a 3D space and are at the heart of everything you do with Core Animation. Like views, layers manage information about the geometry, content, and visual attributes of their surfaces. Unlike views, layers do not define their own appearance.More detail about layer: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreAnimation_guide/CoreAnimationBasics/CoreAnimationBasics.html#//apple_ref/doc/uid/TP40004514-CH2-SW19.
Core Animation optimizes the caching of layer contents and fast drawing directly on the GPU.
A layer is a model object – it exposes data properties and implements no logic. It has no complex Auto Layout dependencies nor does it handle user interactions.
To compare views and layers side by side, we have a table: 
1. CALayer
An object that manages image-based content and allows you to perform animations on that content.
A layer’s main job is to manage the visual content that you provide but the layer itself has visual attributes that can be set, such as a background color, border, and shadow. In addition to managing visual content, the layer also maintains information about the geometry of its content (such as its position, size, and transform) that is used to present that content onscreen. More detail about CALayer : https://gist.github.com/JeOam/94e833bcefd738d805cc
Core Animation defines many standard layer classes, each of which was designed for a specific use case. The CALayer class is the root class for all layer objects. It defines the behavior that all layer objects must support and is the default type used by layer-backed views. 
2. CALayerDeleagte
▪ You can implement the methods of this protocol to provide the layer’s content, handle the layout of sublayers, and provide custom animation actions to perform. The object that implements this protocol must be assigned to the delegate property of the layer object.
If the layer object was created by a view, the view typically assigns itself as the layer’s delegate automatically, and you should not change that relationship. For layers you create yourself, you can assign a delegate object and use that object to provide the contents of the layer dynamically and perform other task.
3. CAConstraint
A representation of a single layout constraint between two layers.
It is possible to create constraints that result in circular references to the same attributes. In cases where the layout is unable to be computed the behavior is undefined.
4. CAAction
5. CALayoutManager
▪ Methods that allow an object to manage the layout of a layer and its sublayers.
6. CAConstraintLayoutManager
• An object that provides a constraint-based layout manager.
7. CATransform
Every layer has two transform matrices that you can to manipulate the layer.
View Animations
1. AnimationWithBlocks (UIViewAnimationWithBlocks)
In the Animations block the code is executed during the animation.
2. AnimateKeyframes (UIViewKeyframeAnimations)
The animation methods in UIView have allowed animation of animatable properties (such as transform, backgroundColor,frame, center etc) – by setting an end-state, duration and other options such as animation curve. However, setting intermediate states in the animation, so-called key-frames, has not been possible. In this case it was necessary to drop down to CoreAnimation itself and create a CAKeyFrameAnimation. This changes in iOS7 – with the addition of 2 methods to UIView, the first of which is similar to the other block-based animation methods: animateKeyframesWithDuration:delay:options:animations:completion:. This takes floats for duration and delay, a bit-mask for options and blocks for animation and completion – all pretty standard in the world of UIView animations. The difference comes in the method we call inside the animation block: addKeyframeWithRelativeStartTime:relativeDuration:animations:. This method is used to add the fixed points within the animation sequence. More detail: https://www.shinobicontrols.com/blog/ios7-day-by-day-day-11-uiview-key-frame-animations
3. Animations with UIViewPropertyAnimator