Latest 1.0.0
Homepage https://github.com/itsjohnye/YRipple
License MIT
Platforms ios 10.0, requires ARC
Authors

YRipple

YRipple is a framework inherit the legacy from PIRipple.

Now it has been updated to Xcode 10 and Swift 4.2.

Demo

YRipple

For more details see Demo project.

Table of Contents

Installation

Manually:

Simply drop YRipple.swift from "Source" folder into your project (make sure to enable "Copy items if needed" and "Create groups").

Cocoapods:

to the Podfile:

"pod YRipple", "~>1.0.0"

then:

$ pod install

in your project:

import YRipple

Useage

UIView-extention

UIview.rippleBorder(location: yourLocation, color: UIColor)
UIview.rippleFill(location: yourLocation, color: UIColor)
for example
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
       super.touchesBegan(touches, with: event)
       for touch: AnyObject in touches {
           let t: UITouch = touch as! UITouch
           let location = t.location(in: self)

           //RIPPLE BORDER
           rippleBorder(location:location, color: UIColor.white)       
       }

run your code after animation

rippleBorder(location:location, color: UIColor.white){
  print("animation completed")
  // add your code here
}

Class-method

YRipple.border(view:UIView, locationInView or absolutePosition:CGPoint, color:UIColor)
YRipple.fill(view:UIView, locationInView or absolutePosition:CGPoint, color:UIColor)

notably:

  • locationInView: CGPoint.Zero is top & left in UIView.
  • absolutePosition: CGPoint.Zero is top & left in UIWindow.
for example
YRipple.border(view:self.view, locationInView:CGPoint.Zero, color:UIColor.white)

run your code after animation

YRipple.border(view:tagetView, locationInView:CGPoint.Zero, color:UIColor.white) {
  print("animation completed")
  //add your code here
}

Customizing

example properties
var option = YRipple.Option()       //mind the capital form

//configuration
option.borderWidth = CGFloat(5.0)
option.radius = CGFloat(30.0)
option.duration = CFTimeInterval(0.4)
option.borderColor = UIColor.white
option.fillColor = UIColor.clear
option.scale = CGFloat(3.0)

YRipple.run(view:self.view, locationInView: CGPoint.Zero, option: option){
  print("animation completed")
  //add your code here
}

//cancel animation
UIView.rippleStop()
YRipple.stop(self.view)

License

YRipple is published under the MIT license.

Latest podspec

{
    "name": "YRipple",
    "version": "1.0.0",
    "summary": "iOS Ripple Effect",
    "description": "A simple framework for iOS Ripple Effect",
    "homepage": "https://github.com/itsjohnye/YRipple",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "itsjohnye": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "swift_version": "4.2",
    "source": {
        "git": "https://github.com/itsjohnye/YRipple.git",
        "tag": "1.0.0"
    },
    "source_files": "Source/YRipple.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This