Video Tutorial: iOS Animation with Swift Part 10: Gradient Animations

Learn how to use CAGradientLayer to draw gradients on screen. By Marin Todorov.

Leave a rating/review
Save for later
Share

Contents

Hide contents

Video Tutorial: iOS Animation with Swift Part 10: Gradient Animations

1 min

 

Update 12/23/14: Series updated for Xcode 6.1.1

Challenge

Your challenge in this tutorial is to change the colors and locations of the gradient layer so it’ll show up a rainbow like psychedelic effect. See the Challenge PDF for full details!

Note: The download files are updated for compatibility with Xcode 6.1 and later. This code from the video:

text.drawInRect(bounds, withAttributes: [
  NSFontAttributeName: font,
  NSParagraphStyleAttributeName: style
  ]
)

has been replaced in 6.1 with:

let attrs = NSMutableDictionary()
attrs[NSFontAttributeName] = font
attrs[NSParagraphStyleAttributeName] = style
    
text.drawInRect(bounds, withAttributes: attrs)

If you have Xcode earlier than version 6.1, please update to the latest version from the App Store.

Download lecture slides

Download starter (update 6.1)

Download demo finished (update 6.1)

Download challenge finished (update 6.1)

View previous video: Part 9: Shape and Mask Animations

view next video: Part 11: Stroke Animation

Contributors

Over 300 content creators. Join our team.