Skip to content

Instantly share code, notes, and snippets.

@arol
Created May 13, 2013 11:15
Show Gist options
  • Save arol/5567624 to your computer and use it in GitHub Desktop.
Save arol/5567624 to your computer and use it in GitHub Desktop.
// Create a basic animation changing the transform.scale value
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
// Set the initial and the final values
[animation setFromValue:[NSNumber numberWithFloat:1.5f]];
[animation setToValue:[NSNumber numberWithFloat:1.f]];
// Set duration
[animation setDuration:0.5f];
// Set animation to be consistent on completion
[animation setRemovedOnCompletion:NO];
[animation setFillMode:kCAFillModeForwards];
// Add animation to the view's layer
[[theView layer] addAnimation:animation forKey:@"scale"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment