YRipple is a framework inherit the legacy from PIRipple.
Now it has been updated to Xcode 10 and Swift 5.
For more details see Demo project.
Simply drop YRipple.swift
from "Source" folder into your project (make sure to enable "Copy items if needed" and "Create groups").
to the Podfile:
"pod YRipple", "~>1.0.0"
then:
$ pod install
in your project:
import YRipple
UIView.rippleBorder(location: yourLocation, color: UIColor)
UIView.rippleFill(location: yourLocation, color: UIColor)
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
}
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.
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
}
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)
YRipple is published under the MIT license. Copyright (c) 2018 itsjohnye.