Giter Club home page Giter Club logo

gradientanimator's Introduction

GradientAnimator

GradientAnimator helps to fill your view with vibrant gradient theme colours and animates them to give a stunning view to your application design

Preview

Installation

Cocoapods installation is available " pod 'GradientAnimator', '~> 1.0' "

Compatibility

  • iOS 11.0+
  • Swift 4.2

Usage

  1. After installing the library import GradientAnimator to your controller

  2. 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)
  1. You can also set custom UIColor combination of your choice as per order using the following initializer
 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)
  1. GradientPoints - Gradient points are used to know from where yo wish to start your animation and to where to end and begins the next transition start point states from where to begin and endpoint states where to end
enum GradientPoints: Int {
case left
case top
case right
case bottom
case topLeft
case topRight
case bottomLeft
case bottomRight
}
  1. After Initializing the gradient view we need to insert the gradient view at the index zero of subview and after that call the startAnimate() method to begin your animation
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()
  1. For your convenience we wrote an extension of UIView so that you could simply call it on any view you would like the gradient animator to be there use the above code
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()
}
}
}

Author

iLeaf Solutions http://www.ileafsolutions.com

gradientanimator's People

Contributors

ileafsolutionspvtltd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.