Skip to content

Instantly share code, notes, and snippets.

@kyleturner
Created January 8, 2012 09:03
Show Gist options
  • Save kyleturner/1577785 to your computer and use it in GitHub Desktop.
Save kyleturner/1577785 to your computer and use it in GitHub Desktop.
CABasicAnimation opacity
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"];
[animation setFromValue:[NSNumber numberWithFloat:1.0]];
[animation setToValue:[NSNumber numberWithFloat:0.0]];
[animation setDuration:0.5f];
[animation setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionLinear]];
[animation setAutoreverses:YES];
[animation setRepeatCount:20000];
[[view layer] addAnimation:animation forKey:@"opacity"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment