I have a CALayer I've added to my view:
myView.myCALayer = [[CALayer alloc] init]; CGSize size = myView.frame.size; myView.myCALayer.frame = CGRectMake(0, 0, size.width, size.height); myView.myCALayer.backgroundColor = [[UIColor blackColor] CGColor]; [myView.layer addSublayer:myView.myCALayer];
When I attempt to change the frame of the CALayer after changing the frame of myView, the resize of the CALayer animates. I have added no animation to the CALayer, so I don't understand this. I've even attempted to call removeAllAnimations on the layer before the resize and it still animates the resize.
Anyone know what could be going on here?
Although it's no longer necessary, it's still used by many animators for the following two purposes: Tradition: To replicate the traditional qualities of hand-drawn animation. Practicality: Certain types of animation (such as stop motion or rotoscope) can only be produced frame-by-frame.
Click the new layer button at the bottom of the timeline. Select Insert > Timeline > Layer. Right-click (Windows) or control+click (Macintosh) a layer name in the timeline and select Insert Layer from the context menu.
Frame-by-frame animation is where each incremental frame (or image) of an animation is drawn individually to create the illusion of movement. This is in contrast to computer generated or motion graphics animation, where the computer can create images on its own within parameters set by the animator.
Layers enable you to organize the artwork in your document. You can draw and edit objects on one layer without affecting objects on another layer.
There is actually an implicit animation on setting some values for a CALayer. You have to disable the animations before you set a new frame.
[CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; [myView.myCALayer.frame = (CGRect){ { 10, 10 }, { 100, 100 } ]; [CATransaction commit];
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/AdvancedAnimationTricks/AdvancedAnimationTricks.html#//apple_ref/doc/uid/TP40004514-CH8-SW3
In Swift 4:
CATransaction.begin() CATransaction.setDisableActions(true) /* Your layer / frame changes here */ CATransaction.commit()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With