Skip to content

Instantly share code, notes, and snippets.

@darkseed
Created August 14, 2011 15:22
Show Gist options
  • Save darkseed/1144976 to your computer and use it in GitHub Desktop.
Save darkseed/1144976 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