Skip to content

Instantly share code, notes, and snippets.

@kishorek
Forked from darkseed/gist:1144976
Created March 27, 2012 09:46
Show Gist options
  • Save kishorek/2214453 to your computer and use it in GitHub Desktop.
Save kishorek/2214453 to your computer and use it in GitHub Desktop.
CABasicAnimation movement
//Create a CABasicAnimation object
CABasicAnimation *move = [CABasicAnimation animationWithKeyPath:@"transform.translation.y" ];
[move setFromValue:[NSNumber numberWithFloat:0.0f]];
[move setToValue:[NSNumber numberWithFloat:100.0f]];
[move setDuration:0.3f];
//Add animation to a specific element's layer. Must be called after the element is displayed.
[[element layer] addAnimation:move forKey:@"transform.translation.y"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment