All Projects → hadashiA → RippleLayer

hadashiA / RippleLayer

Licence: MIT license
Drawing splash effect

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

RippleLayer

Version License Platform

Overview

Draw splash effect using CGPath.

RippleLayer

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Getting Started

Installation

RippleLayer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "RippleLayer"

Sample Usage

CALayer subclasses, have been RippleLayer to provide You can be inserted anywhere in the UIView.

class ViewController : UIViewController {
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        let rippleLayer = RippleLayer(
            size: myView.frame.size,
            numSprings: 320,
            random: true)
        rippleLayer.fillColor = UIColor(red: 204/255, green: 233/255, blue: 249/255, alpha: 1.0).CGColor
        myView.layer.addSublayer(rippleLayer)
   }
}

Make a UIView subclass if necessary.

Advanced Usage

RippleLayer Init(size:numSprings:random:)

name type description
size CGFloat It will be drawn in this size, but sometimes Protrude by the height of the waves
numSprings CGFlaot Waves, are made with a large amount of Spring. We specify amount.
random Bool if true, random ripple

RippleLayer rippleAt(i:height:)

Ripple in any position

name type description
i CGFloat Ripple x position. Specify the index of spring.
height CGFlaot Ripple height

Author

hadashiA, https://twitter.com/hadashiA

License

RippleLayer is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].