How can I create an CABasicAnimation for multiple properties?

You can create an CAAnimationGroup and customize the duration and timing function on it. Then you create all your CABasicAnimations, set their to value and add them to the animation group. Finally, you add the animation group to the layer that you are animating. Here an example: CABasicAnimation *makeBiggerAnim=[CABasicAnimation animationWithKeyPath:@”cornerRadius”]; makeBiggerAnim.fromValue=[NSNumber numberWithDouble:20.0]; makeBiggerAnim.toValue=[NSNumber numberWithDouble:40.0]; CABasicAnimation … Read more

What is the full Keypath list for CABasicAnimation?

Here’s everything I’m aware of in terms of animatable properties, keyPaths, and key-value coding extensions. CALayer Animatable layer properties — the other CALayer types below all inherit from CALayer, so these also apply to those: anchorPoint backgroundColor backgroundFilters borderColor borderWidth bounds compositingFilter contents contentsRect cornerRadius doubleSided filters frame hidden mask masksToBounds opacity position shadowColor shadowOffset … Read more

How to change CAGradientLayer color points?

The startPoint and endPoint properties of a CAGradientLayer are defined in the “unit coordinate system”. In the unit coordinate system: (0,0) corresponds to the smallest coordinates of the layer’s bounds rectangle, which on iOS is its upper-left corner unless the layer has been transformed; (1,1) corresponds to the largest coordinates of the layer’s bounds rectangle, … Read more

CAKeyframeAnimation delay before repeating

By dumping the animations of Apple’s MKUserLocationView, I was able to see how they were doing it. Turns out that this is what CAAnimationGroup is for. By encapsulating a 2 seconds animation into a 5 seconds animation group, you’ll end up with a 2 seconds animation followed by a 3 seconds delay: CAAnimationGroup *animationGroup = … Read more

Animation Duration for UICollectionView selectItemAtIndexPath:animated:scrollPosition:

I had similar problems with UITableView which I solved by the following code: [CATransaction begin]; [CATransaction setCompletionBlock:onCompletion]; [CATransaction setAnimationDuration:duration]; [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:3 inSection:3] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES]; [CATransaction commit]; Obviously, you can’t call it with animated:NO because the animation code inside the method is important. Using a CATransaction to wrap the animation worked for me.

CoreAnimation warning deleted thread with uncommitted CATransaction

In keeping with standard Cocoa paradigms, the recommended solution here is to perform your Core Animation work on the main thread, easily done with GCD: dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate redrawSomething]; }); In general it’s poor form to call objects in contexts they don’t expect, so a good rule of thumb is to always dispatch onto the … Read more

Fastest way to do shadows on iOS?

Adding a shadowPath should give you a huge performance boost. The following example assumes you only want the shadow on the sides of your view CGPathRef path = [UIBezierPath bezierPathWithRect:view.bounds].CGPath; [view.layer setShadowPath:path]; EDIT: On default a CALayer draws a shadow during animations, the following code allows you to cache the shadow as a bitmap and … Read more

Chaining Core Animation animations

You can also use animation grouping and use the beginTime field of the animation. Try something like this: CABasicAnimation *posAnimation = [CABasicAnimation animationWithKeyPath:@”position”]; [posAnimation setFromValue:[NSNumber numberWithFloat:0.0]]; [posAnimation setToValue:[NSNumber numberWithFloat:1.0]]; // Here’s the important part [posAnimation setDuration:10.0]; [posAnimation setBeginTime:0.0]; CABasicAnimation *borderWidthAnimation = [CABasicAnimation animationWithKeyPath:@”borderWidth”]; [borderWidthAnimation setFromValue:[NSNumber numberWithFloat:0.0]]; [borderWidthAnimation setToValue:[NSNumber numberWithFloat:1.0]]; // Here’s the important part [borderWidthAnimation … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)