Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Classes/ZFRippleButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ open class ZFRippleButton: UIButton {
touchCenterLocation = nil
}

UIView.animate(withDuration: 0.1, delay: 0, options: UIViewAnimationOptions.allowUserInteraction, animations: {
self.rippleBackgroundView.alpha = 1
UIView.animate(withDuration: 0.1, delay: 0, options: .allowUserInteraction, animations: { [weak self] in
self?.rippleBackgroundView.alpha = 1
}, completion: nil)

rippleView.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)


UIView.animate(withDuration: 0.7, delay: 0, options: [UIViewAnimationOptions.curveEaseOut, UIViewAnimationOptions.allowUserInteraction],
animations: {
self.rippleView.transform = CGAffineTransform.identity
UIView.animate(withDuration: 0.7, delay: 0, options: [.curveEaseOut, .allowUserInteraction],
animations: { [weak self] in
self?.rippleView.transform = CGAffineTransform.identity
}, completion: nil)

if shadowRippleEnable {
Expand All @@ -132,7 +132,7 @@ open class ZFRippleButton: UIButton {

let groupAnim = CAAnimationGroup()
groupAnim.duration = 0.7
groupAnim.fillMode = kCAFillModeForwards
groupAnim.fillMode = .forwards
groupAnim.isRemovedOnCompletion = false
groupAnim.animations = [shadowAnim, opacityAnim]

Expand All @@ -152,33 +152,33 @@ open class ZFRippleButton: UIButton {
}

fileprivate func animateToNormal() {
UIView.animate(withDuration: 0.1, delay: 0, options: UIViewAnimationOptions.allowUserInteraction, animations: {
self.rippleBackgroundView.alpha = 1
UIView.animate(withDuration: 0.1, delay: 0, options: .allowUserInteraction, animations: { [weak self] in
self?.rippleBackgroundView.alpha = 1
}, completion: {(success: Bool) -> () in
UIView.animate(withDuration: self.touchUpAnimationTime, delay: 0, options: UIViewAnimationOptions.allowUserInteraction, animations: {
self.rippleBackgroundView.alpha = 0
UIView.animate(withDuration: self.touchUpAnimationTime, delay: 0, options: .allowUserInteraction, animations: { [weak self] in
self?.rippleBackgroundView.alpha = 0
}, completion: nil)
})


UIView.animate(withDuration: 0.7, delay: 0,
options: [.curveEaseOut, .beginFromCurrentState, .allowUserInteraction],
animations: {
self.rippleView.transform = CGAffineTransform.identity
animations: { [weak self, tempShadowRadius, tempShadowOpacity] in
self?.rippleView.transform = CGAffineTransform.identity

let shadowAnim = CABasicAnimation(keyPath:"shadowRadius")
shadowAnim.toValue = self.tempShadowRadius
shadowAnim.toValue = tempShadowRadius

let opacityAnim = CABasicAnimation(keyPath:"shadowOpacity")
opacityAnim.toValue = self.tempShadowOpacity
opacityAnim.toValue = tempShadowOpacity

let groupAnim = CAAnimationGroup()
groupAnim.duration = 0.7
groupAnim.fillMode = kCAFillModeForwards
groupAnim.fillMode = .forwards
groupAnim.isRemovedOnCompletion = false
groupAnim.animations = [shadowAnim, opacityAnim]

self.layer.add(groupAnim, forKey:"shadowBack")
self?.layer.add(groupAnim, forKey:"shadowBack")
}, completion: nil)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,23 +352,25 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = ZFRippleButtonDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
DC346CD5195F150E0099F81E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = ZFRippleButtonDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down