The Only CAGradientLayer Guide You Will Ever Need

An App to help you? Why not?

Image for post
Image for post
Photo by JD Chow on Unsplash

Prerequisites:

Terminology:

The App

Image for post
Image for post
gradient.colors = colours.map{ $0.cgColor }
let animation = CABasicAnimation(keyPath: "endPoint")animation.fromValue = gradient.endPointanimation.toValue = endPoint.pointanimation.duration = 5.0self.gradient.endPoint = endPoint.pointself.gradient.add(animation, forKey:"animateendpoint")

location (which is linked to colour)

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

startPoint and endPoint

Image for post
Image for post

Type

Tips to recreate the App

Conclusion

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store