Commit 83482643 by Daniel Dahan

added pulseAnimation enum

parent cbedb1d7
......@@ -7,8 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
9658F1F91CD6AA4900B902C1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F1F81CD6AA4900B902C1 /* Material.framework */; };
9658F1FA1CD6AA4900B902C1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F1F81CD6AA4900B902C1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
965E8E721C14A4950035A270 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965E8E711C14A4950035A270 /* AppDelegate.swift */; };
965E8E741C14A4950035A270 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965E8E731C14A4950035A270 /* ViewController.swift */; };
965E8E791C14A4950035A270 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 965E8E781C14A4950035A270 /* Assets.xcassets */; };
......@@ -22,7 +20,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9658F1FA1CD6AA4900B902C1 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -30,7 +27,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9658F1F81CD6AA4900B902C1 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
965E8E6E1C14A4950035A270 /* MaterialButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MaterialButton.app; sourceTree = BUILT_PRODUCTS_DIR; };
965E8E711C14A4950035A270 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
965E8E731C14A4950035A270 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
......@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9658F1F91CD6AA4900B902C1 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -54,7 +49,6 @@
965E8E651C14A4950035A270 = {
isa = PBXGroup;
children = (
9658F1F81CD6AA4900B902C1 /* Material.framework */,
965E8E701C14A4950035A270 /* MaterialButton */,
965E8E6F1C14A4950035A270 /* Products */,
);
......
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
9658F2111CD6CDD700B902C1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F2101CD6CDD700B902C1 /* Material.framework */; };
9658F2121CD6CDD700B902C1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F2101CD6CDD700B902C1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96DB1C5F1C14AA2800825BE6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96DB1C5E1C14AA2800825BE6 /* AppDelegate.swift */; };
96DB1C611C14AA2800825BE6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96DB1C601C14AA2800825BE6 /* ViewController.swift */; };
96DB1C661C14AA2800825BE6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96DB1C651C14AA2800825BE6 /* Assets.xcassets */; };
......@@ -20,6 +22,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9658F2121CD6CDD700B902C1 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9658F2101CD6CDD700B902C1 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
96DB1C5B1C14AA2800825BE6 /* MaterialPulseView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MaterialPulseView.app; sourceTree = BUILT_PRODUCTS_DIR; };
96DB1C5E1C14AA2800825BE6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96DB1C601C14AA2800825BE6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
......@@ -40,6 +44,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9658F2111CD6CDD700B902C1 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -49,6 +54,7 @@
96DB1C521C14AA2800825BE6 = {
isa = PBXGroup;
children = (
9658F2101CD6CDD700B902C1 /* Material.framework */,
96DB1C5D1C14AA2800825BE6 /* MaterialPulseView */,
96DB1C5C1C14AA2800825BE6 /* Products */,
);
......
......@@ -41,7 +41,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareGeneralMaterialPulseViewExample()
prepareMaterialPulseView()
}
/// General preparation statements.
......@@ -50,16 +50,16 @@ class ViewController: UIViewController {
}
/// Prepares the MaterialPulseView example.
private func prepareGeneralMaterialPulseViewExample() {
private func prepareMaterialPulseView() {
let diameter: CGFloat = 150
let point: CGFloat = (MaterialDevice.width - diameter) / 2
let pulseView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(point, point, diameter, diameter))
pulseView.image = UIImage(named: "Graph")
// pulseView.image = UIImage(named: "Graph")
pulseView.shape = .Square
pulseView.depth = .Depth1
pulseView.cornerRadiusPreset = .Radius3
// pulseView.pulseFocus = true // Optional focus animation.
// pulseView.pulseAnimation = .CenterWithBacking // Set a different type of pulse animation.
// Add pulseView to UIViewController.
view.addSubview(pulseView)
......
......@@ -55,6 +55,9 @@ public class MaterialButton : UIButton {
/// The color of the pulse effect.
@IBInspectable public var pulseColor: UIColor?
/// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking
/**
This property is the same as clipsToBounds. It crops any of the view's
contents from bleeding past the view's frame. If an image is set using
......@@ -404,11 +407,11 @@ public class MaterialButton : UIButton {
public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point!
if let color: UIColor = pulseColor {
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
MaterialAnimation.delay(0.35) { [weak self] in
if let s: MaterialButton = self {
MaterialAnimation.pulseContractAnimation(s.layer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers)
MaterialAnimation.pulseContractAnimation(s.layer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
}
}
}
......@@ -421,7 +424,7 @@ public class MaterialButton : UIButton {
*/
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......@@ -432,7 +435,7 @@ public class MaterialButton : UIButton {
*/
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......@@ -443,7 +446,7 @@ public class MaterialButton : UIButton {
*/
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......
......@@ -55,6 +55,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/// The color of the pulse effect.
@IBInspectable public var pulseColor: UIColor?
/// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking
/**
A property that manages an image for the visualLayer's contents
property. Images should not be set to the backing layer's contents
......@@ -509,11 +512,11 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point!
if let color: UIColor = pulseColor {
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
MaterialAnimation.delay(0.35) { [weak self] in
if let s: MaterialCollectionViewCell = self {
MaterialAnimation.pulseContractAnimation(s.layer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers)
MaterialAnimation.pulseContractAnimation(s.layer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
}
}
}
......@@ -526,7 +529,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......@@ -537,7 +540,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......@@ -548,7 +551,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......
......@@ -30,6 +30,15 @@
import UIKit
public enum PulseAnimation {
case None
case Center
case CenterWithBacking
case Backing
case AtPoint
case AtPointWithBacking
}
internal extension MaterialAnimation {
/**
Triggers the expanding animation.
......@@ -42,29 +51,44 @@ internal extension MaterialAnimation {
- Parameter duration: Animation duration.
- Parameter pulseLayers: An Array of CAShapeLayers used in the animation.
*/
internal static func pulseExpandAnimation(layer: CALayer, visualLayer: CALayer, pulseColor: UIColor?, pulseOpacity: CGFloat, point: CGPoint, width: CGFloat, height: CGFloat, inout pulseLayers: Array<CAShapeLayer>) {
if let color: UIColor = pulseColor {
if let n: CGFloat = width < height ? height : width {
if let pOpacity: CGFloat = pulseOpacity {
let bLayer: CAShapeLayer = CAShapeLayer()
let pLayer: CAShapeLayer = CAShapeLayer()
bLayer.addSublayer(pLayer)
pulseLayers.insert(bLayer, atIndex: 0)
visualLayer.addSublayer(bLayer)
MaterialAnimation.animationDisabled({
bLayer.frame = visualLayer.bounds
pLayer.bounds = CGRectMake(0, 0, n, n)
pLayer.position = point
pLayer.cornerRadius = n / 2
pLayer.backgroundColor = color.colorWithAlphaComponent(pOpacity).CGColor
pLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(0, 0))
})
bLayer.setValue(false, forKey: "animated")
bLayer.addAnimation(MaterialAnimation.backgroundColor(color.colorWithAlphaComponent(pOpacity / 2), duration: 0.35), forKey: nil)
pLayer.addAnimation(MaterialAnimation.scale(1, duration: 0.35), forKey: nil)
MaterialAnimation.delay(0.35, completion: {
bLayer.setValue(true, forKey: "animated")
})
internal static func pulseExpandAnimation(layer: CALayer, visualLayer: CALayer, pulseColor: UIColor?, pulseOpacity: CGFloat, point: CGPoint, width: CGFloat, height: CGFloat, inout pulseLayers: Array<CAShapeLayer>, pulseAnimation: PulseAnimation) {
if .None != pulseAnimation {
if let color: UIColor = pulseColor {
if let n: CGFloat = width < height ? height : width {
if let pOpacity: CGFloat = pulseOpacity {
let bLayer: CAShapeLayer = CAShapeLayer()
let pLayer: CAShapeLayer = CAShapeLayer()
bLayer.addSublayer(pLayer)
pulseLayers.insert(bLayer, atIndex: 0)
visualLayer.addSublayer(bLayer)
MaterialAnimation.animationDisabled({
bLayer.frame = visualLayer.bounds
pLayer.bounds = CGRectMake(0, 0, n, n)
switch pulseAnimation {
case .Center, .CenterWithBacking:
pLayer.position = CGPointMake(width / 2, height / 2)
default:
pLayer.position = point
}
pLayer.cornerRadius = n / 2
pLayer.backgroundColor = color.colorWithAlphaComponent(pOpacity).CGColor
pLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(0, 0))
})
bLayer.setValue(false, forKey: "animated")
switch pulseAnimation {
case .CenterWithBacking, .Backing, .AtPointWithBacking:
bLayer.addAnimation(MaterialAnimation.backgroundColor(color.colorWithAlphaComponent(pOpacity / 2), duration: 0.35), forKey: nil)
default:break
}
switch pulseAnimation {
case .Center, .CenterWithBacking, .AtPoint, .AtPointWithBacking:
pLayer.addAnimation(MaterialAnimation.scale(1, duration: 0.35), forKey: nil)
default:break
}
MaterialAnimation.delay(0.35, completion: {
bLayer.setValue(true, forKey: "animated")
})
}
}
}
}
......@@ -76,18 +100,25 @@ internal extension MaterialAnimation {
- Parameter pulseColor: The UIColor for the pulse.
- Parameter pulseLayers: An Array of CAShapeLayers used in the animation.
*/
internal static func pulseContractAnimation(layer: CALayer, pulseColor: UIColor?, inout pulseLayers: Array<CAShapeLayer>) {
internal static func pulseContractAnimation(layer: CALayer, pulseColor: UIColor?, inout pulseLayers: Array<CAShapeLayer>, pulseAnimation: PulseAnimation) {
if let color: UIColor = pulseColor {
if let bLayer: CAShapeLayer = pulseLayers.popLast() {
let animated: Bool? = bLayer.valueForKey("animated") as? Bool
MaterialAnimation.delay(true == animated ? 0 : 0.15) {
if let pLayer: CAShapeLayer = bLayer.sublayers?.first as? CAShapeLayer {
bLayer.addAnimation(MaterialAnimation.backgroundColor(color.colorWithAlphaComponent(0), duration: 0.35), forKey: nil)
pLayer.addAnimation(MaterialAnimation.animationGroup([
MaterialAnimation.scale(1.35),
MaterialAnimation.backgroundColor(color.colorWithAlphaComponent(0))
switch pulseAnimation {
case .CenterWithBacking, .Backing, .AtPointWithBacking:
bLayer.addAnimation(MaterialAnimation.backgroundColor(color.colorWithAlphaComponent(0), duration: 0.35), forKey: nil)
default:break
}
switch pulseAnimation {
case .Center, .CenterWithBacking, .AtPoint, .AtPointWithBacking:
pLayer.addAnimation(MaterialAnimation.animationGroup([
MaterialAnimation.scale(1.35),
MaterialAnimation.backgroundColor(color.colorWithAlphaComponent(0))
], duration: 0.35), forKey: nil)
default:break
}
MaterialAnimation.delay(0.35) {
pLayer.removeFromSuperlayer()
bLayer.removeFromSuperlayer()
......
......@@ -43,6 +43,9 @@ public class MaterialPulseView : MaterialView {
/// The color of the pulse effect.
@IBInspectable public var pulseColor: UIColor?
/// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking
/**
Triggers the pulse animation.
- Parameter point: A Optional point to pulse from, otherwise pulses
......@@ -51,11 +54,11 @@ public class MaterialPulseView : MaterialView {
public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point!
if let color: UIColor = pulseColor {
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
MaterialAnimation.delay(0.35) { [weak self] in
if let s: MaterialPulseView = self {
MaterialAnimation.pulseContractAnimation(s.layer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers)
MaterialAnimation.pulseContractAnimation(s.layer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
}
}
}
......@@ -68,7 +71,7 @@ public class MaterialPulseView : MaterialView {
*/
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......@@ -79,7 +82,7 @@ public class MaterialPulseView : MaterialView {
*/
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......@@ -90,7 +93,7 @@ public class MaterialPulseView : MaterialView {
*/
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......
......@@ -54,6 +54,9 @@ public class MaterialTableViewCell : UITableViewCell {
/// The color of the pulse effect.
@IBInspectable public var pulseColor: UIColor?
/// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking
/**
This property is the same as clipsToBounds. It crops any of the view's
contents from bleeding past the view's frame. If an image is set using
......@@ -359,11 +362,11 @@ public class MaterialTableViewCell : UITableViewCell {
public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point!
if let color: UIColor = pulseColor {
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
MaterialAnimation.delay(0.35) { [weak self] in
if let s: MaterialTableViewCell = self {
MaterialAnimation.pulseContractAnimation(s.layer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers)
MaterialAnimation.pulseContractAnimation(s.layer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
}
}
}
......@@ -376,7 +379,7 @@ public class MaterialTableViewCell : UITableViewCell {
*/
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......@@ -387,7 +390,7 @@ public class MaterialTableViewCell : UITableViewCell {
*/
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......@@ -398,7 +401,7 @@ public class MaterialTableViewCell : UITableViewCell {
*/
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers)
MaterialAnimation.pulseContractAnimation(layer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment