GradientAnimator helps to fill your view with vibrant gradient theme colours and animates them to give a stunning view to your application design
Cocoapods installation is available " pod 'GradientAnimator', '~> 1.3.1' "
After installing the library import GradientAnimator to your controller
Gradient Animator has predefined Themes "GradientThemes" you can use our themes
let gradientView = GradientAnimator(frame: self.view.frame, theme: GradientThemes.Sunrise, _startPoint: GradientPoints.bottomLeft, _endPoint: GradientPoints.topRight, _animationDuration: 3.0)
let gradientView = GradientAnimator(frame: self.frame, inputColors: [#colorLiteral(red: 0.9195817113, green: 0.04345837981, blue: 0.7682360411, alpha: 1),#colorLiteral(red: 0.1406921148, green: 0.05199617893, blue: 0.8817588687, alpha: 1),#colorLiteral(red: 0.9254902005, green: 0.2352941185, blue: 0.1019607857, alpha: 1),#colorLiteral(red: 0.2745098174, green: 0.4862745106, blue: 0.1411764771, alpha: 1),#colorLiteral(red: 0.9725490196, green: 0.7647058824, blue: 0.8039215686, alpha: 1)], _startPoint: GradientPoints.bottomLeft, _endPoint: GradientPoints.topRight, _animationDuration: 2.0)
enum GradientPoints: Int {
case left
case top
case right
case bottom
case topLeft
case topRight
case bottomLeft
case bottomRight
}
let gradientView = GradientAnimator(frame: self.view.frame, theme: GradientThemes.Sunrise, _startPoint: GradientPoints.bottomLeft, _endPoint: GradientPoints.topRight, _animationDuration: 3.0)
self.view.insertSubview(gradientView, at: 0)
gradientView.startAnimate()
extension UIView{
func setGradient(){
self.removeGradient()
let gradientView = GradientAnimator(frame: self.frame, theme: GradientThemes.Sunrise, _startPoint: GradientPoints.bottomLeft, _endPoint: GradientPoints.topRight, _animationDuration: 3.0)
gradientView.tag = 007
self.insertSubview(gradientView, at: 0)
gradientView.startAnimate()
}
func removeGradient(){
if let gradView : GradientAnimator = self.subviews.filter({$0.tag == 007}).first as? GradientAnimator{
gradView.removeFromSuperview()
}
}
}
iLeaf Solutions http://www.ileafsolutions.com
link |
Stars: 72 |
Last commit: 4 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics