Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nacho Soto's Slides at NSSpain 2013

Luis Ascorbe
September 17, 2013

Nacho Soto's Slides at NSSpain 2013

NSSpain is an iOS & OSX developers conference in Spain.
More info: http://nsspain.com

Luis Ascorbe

September 17, 2013
Tweet

More Decks by Luis Ascorbe

Other Decks in Programming

Transcript

  1. CREATING ANIMATIONS WITH CORE ANIMATION & CORE GRAPHICS Mobile Lead,

    MindSnacks Inc. Creator of Sayonara app. Nacho Soto
  2. AGENDA Animation types: Basic animations. Animating transforms. Using Paths. Keyframe

    animations. Mixing things up with Core Graphics: Animating a programmatically drawn view. How to make it fast. • • • • • • • •
  3. const CATransform3D transform = CATransform3DMakeScale(1, 0, 0); CABasicAnimation *animation =

    [CABasicAnimation animationWithKeyPath:NSStringFromSelector(@selector(transform))]; animation.toValue = [NSValue valueWithCATransform3D:transform]; [layer addAnimation:animation forKey:animation.keyPath]; NOT SO BASIC ANIMATION
  4. KEYFRAME ANIMATIONS CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position.x"]; animation.values = [[NSArray

    arrayWithRange:NSMakeRange(0, 100)] mapUsingBlock:^(NSNumber *number) { return @(pow(number.unsignedIntegerValue, 3) / 3000.f); }];
  5. IT’S NOT ALL ABOUT THE GPU CoreGraphics.framework Quartz 2D Quartz

    Services QuartzCore.framework Core Animation Core Image Rendering occurs in the CPU. Then textures are transferred to VRAM and composited there. We only have 1 / 60s (0.016s) to do all the work.