Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
1ef94e71
Unverified
Commit
1ef94e71
authored
Oct 25, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated Animation to Motion
parent
486cab29
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
55 additions
and
54 deletions
+55
-54
Material.xcodeproj/project.pbxproj
+0
-0
Sources/iOS/Button.swift
+7
-7
Sources/iOS/CollectionReusableView.swift
+7
-7
Sources/iOS/CollectionViewCell.swift
+7
-7
Sources/iOS/Material+CALayer.swift
+1
-1
Sources/iOS/Motion.swift
+4
-3
Sources/iOS/MotionBasic.swift
+1
-1
Sources/iOS/MotionKeyframe.swift
+1
-1
Sources/iOS/MotionTransition.swift
+1
-1
Sources/iOS/PulseAnimation.swift
+11
-11
Sources/iOS/PulseView.swift
+7
-7
Sources/iOS/SnackbarController.swift
+1
-1
Sources/iOS/TableViewCell.swift
+7
-7
No files found.
Material.xcodeproj/project.pbxproj
View file @
1ef94e71
This diff is collapsed.
Click to expand it.
Sources/iOS/Button.swift
View file @
1ef94e71
...
@@ -184,13 +184,13 @@ open class Button: UIButton {
...
@@ -184,13 +184,13 @@ open class Button: UIButton {
from the center.
from the center.
*/
*/
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Anima
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Mo
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Anima
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
}
}
bringImageViewToFront
()
bringImageViewToFront
()
...
@@ -204,7 +204,7 @@ open class Button: UIButton {
...
@@ -204,7 +204,7 @@ open class Button: UIButton {
*/
*/
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
bringImageViewToFront
()
bringImageViewToFront
()
}
}
...
@@ -217,7 +217,7 @@ open class Button: UIButton {
...
@@ -217,7 +217,7 @@ open class Button: UIButton {
*/
*/
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -228,7 +228,7 @@ open class Button: UIButton {
...
@@ -228,7 +228,7 @@ open class Button: UIButton {
*/
*/
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
open
func
bringImageViewToFront
()
{
open
func
bringImageViewToFront
()
{
...
...
Sources/iOS/CollectionReusableView.swift
View file @
1ef94e71
...
@@ -238,13 +238,13 @@ open class CollectionReusableView: UICollectionReusableView {
...
@@ -238,13 +238,13 @@ open class CollectionReusableView: UICollectionReusableView {
from the center.
from the center.
*/
*/
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Anima
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Mo
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Anima
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
}
}
}
}
...
@@ -256,7 +256,7 @@ open class CollectionReusableView: UICollectionReusableView {
...
@@ -256,7 +256,7 @@ open class CollectionReusableView: UICollectionReusableView {
*/
*/
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -267,7 +267,7 @@ open class CollectionReusableView: UICollectionReusableView {
...
@@ -267,7 +267,7 @@ open class CollectionReusableView: UICollectionReusableView {
*/
*/
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -278,7 +278,7 @@ open class CollectionReusableView: UICollectionReusableView {
...
@@ -278,7 +278,7 @@ open class CollectionReusableView: UICollectionReusableView {
*/
*/
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
/**
/**
...
...
Sources/iOS/CollectionViewCell.swift
View file @
1ef94e71
...
@@ -245,13 +245,13 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -245,13 +245,13 @@ open class CollectionViewCell: UICollectionViewCell {
from the center.
from the center.
*/
*/
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Anima
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Mo
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Anima
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
}
}
}
}
...
@@ -263,7 +263,7 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -263,7 +263,7 @@ open class CollectionViewCell: UICollectionViewCell {
*/
*/
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -274,7 +274,7 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -274,7 +274,7 @@ open class CollectionViewCell: UICollectionViewCell {
*/
*/
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -285,7 +285,7 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -285,7 +285,7 @@ open class CollectionViewCell: UICollectionViewCell {
*/
*/
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
/**
/**
...
...
Sources/iOS/Material+CALayer.swift
View file @
1ef94e71
...
@@ -321,7 +321,7 @@ extension CALayer {
...
@@ -321,7 +321,7 @@ extension CALayer {
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
}
else
{
}
else
{
let
a
=
Anima
tion
.
shadowPath
(
to
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
)
let
a
=
Mo
tion
.
shadowPath
(
to
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
)
a
.
fromValue
=
shadowPath
a
.
fromValue
=
shadowPath
animate
(
animation
:
a
)
animate
(
animation
:
a
)
}
}
...
...
Sources/iOS/
Anima
tion.swift
→
Sources/iOS/
Mo
tion.swift
View file @
1ef94e71
...
@@ -57,11 +57,11 @@ public func AnimationFillModeToValue(mode: AnimationFillMode) -> String {
...
@@ -57,11 +57,11 @@ public func AnimationFillModeToValue(mode: AnimationFillMode) -> String {
@objc(AnimationTimingFunction)
@objc(AnimationTimingFunction)
public
enum
AnimationTimingFunction
:
Int
{
public
enum
AnimationTimingFunction
:
Int
{
case
`
default
`
case
linear
case
linear
case
easeIn
case
easeIn
case
easeOut
case
easeOut
case
easeInEaseOut
case
easeInEaseOut
case
`
default
`
}
}
/**
/**
...
@@ -86,7 +86,7 @@ public func AnimationTimingFunctionToValue(function: AnimationTimingFunction) ->
...
@@ -86,7 +86,7 @@ public func AnimationTimingFunctionToValue(function: AnimationTimingFunction) ->
public
typealias
AnimationDelayCancelBlock
=
(
Bool
)
->
Void
public
typealias
AnimationDelayCancelBlock
=
(
Bool
)
->
Void
public
struct
Anima
tion
{
public
struct
Mo
tion
{
/**
/**
Executes a block of code after a time delay.
Executes a block of code after a time delay.
- Parameter duration: An animation duration time.
- Parameter duration: An animation duration time.
...
@@ -160,7 +160,7 @@ public struct Animation {
...
@@ -160,7 +160,7 @@ public struct Animation {
- Returns: A CAAnimationGroup.
- Returns: A CAAnimationGroup.
*/
*/
public
static
func
animate
(
group
animations
:
[
CAAnimation
],
duration
:
CFTimeInterval
=
0.5
)
->
CAAnimationGroup
{
public
static
func
animate
(
group
animations
:
[
CAAnimation
],
duration
:
CFTimeInterval
=
0.5
)
->
CAAnimationGroup
{
let
group
:
CAAnimationGroup
=
CAAnimationGroup
()
let
group
=
CAAnimationGroup
()
group
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
forwards
)
group
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
forwards
)
group
.
isRemovedOnCompletion
=
false
group
.
isRemovedOnCompletion
=
false
group
.
animations
=
animations
group
.
animations
=
animations
...
@@ -183,3 +183,4 @@ public struct Animation {
...
@@ -183,3 +183,4 @@ public struct Animation {
}
}
}
}
}
}
Sources/iOS/
BasicAnimation
.swift
→
Sources/iOS/
MotionBasic
.swift
View file @
1ef94e71
...
@@ -60,7 +60,7 @@ extension CABasicAnimation {
...
@@ -60,7 +60,7 @@ extension CABasicAnimation {
}
}
}
}
extension
Anima
tion
{
extension
Mo
tion
{
/**
/**
Creates a CABasicAnimation for the backgroundColor key path.
Creates a CABasicAnimation for the backgroundColor key path.
- Parameter color: A UIColor.
- Parameter color: A UIColor.
...
...
Sources/iOS/
KeyframeAnimation
.swift
→
Sources/iOS/
MotionKeyframe
.swift
View file @
1ef94e71
...
@@ -53,7 +53,7 @@ public func AnimationRotationModeToValue(mode: AnimationRotationMode) -> String?
...
@@ -53,7 +53,7 @@ public func AnimationRotationModeToValue(mode: AnimationRotationMode) -> String?
}
}
}
}
extension
Anima
tion
{
extension
Mo
tion
{
/**
/**
Creates a CAKeyframeAnimation.
Creates a CAKeyframeAnimation.
- Parameter bezierPath: A UIBezierPath.
- Parameter bezierPath: A UIBezierPath.
...
...
Sources/iOS/
TransitionAnima
tion.swift
→
Sources/iOS/
MotionTransi
tion.swift
View file @
1ef94e71
...
@@ -85,7 +85,7 @@ public func AnimationTransitionDirectionToValue(direction: AnimationTransitionDi
...
@@ -85,7 +85,7 @@ public func AnimationTransitionDirectionToValue(direction: AnimationTransitionDi
}
}
}
}
extension
Anima
tion
{
extension
Mo
tion
{
/**
/**
Creates a CATransition animation.
Creates a CATransition animation.
- Parameter type: An AnimationTransition.
- Parameter type: An AnimationTransition.
...
...
Sources/iOS/PulseAnimation.swift
View file @
1ef94e71
...
@@ -42,7 +42,7 @@ public enum PulseAnimation: Int {
...
@@ -42,7 +42,7 @@ public enum PulseAnimation: Int {
case
pointWithBacking
case
pointWithBacking
}
}
internal
extension
Anima
tion
{
internal
extension
Mo
tion
{
/**
/**
Triggers the expanding animation.
Triggers the expanding animation.
- Parameter layer: Container CALayer.
- Parameter layer: Container CALayer.
...
@@ -71,7 +71,7 @@ internal extension Animation {
...
@@ -71,7 +71,7 @@ internal extension Animation {
visualLayer
.
masksToBounds
=
!
(
.
centerRadialBeyondBounds
==
pulse
.
animation
||
.
radialBeyondBounds
==
pulse
.
animation
)
visualLayer
.
masksToBounds
=
!
(
.
centerRadialBeyondBounds
==
pulse
.
animation
||
.
radialBeyondBounds
==
pulse
.
animation
)
Anima
tion
.
disable
(
animations
:
{
[
visualLayer
=
visualLayer
,
pulse
=
pulse
]
in
Mo
tion
.
disable
(
animations
:
{
[
visualLayer
=
visualLayer
,
pulse
=
pulse
]
in
bLayer
.
frame
=
visualLayer
.
bounds
bLayer
.
frame
=
visualLayer
.
bounds
pLayer
.
bounds
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
n
,
height
:
n
)
pLayer
.
bounds
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
n
,
height
:
n
)
...
@@ -93,17 +93,17 @@ internal extension Animation {
...
@@ -93,17 +93,17 @@ internal extension Animation {
switch
pulse
.
animation
{
switch
pulse
.
animation
{
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
:
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
:
bLayer
.
add
(
Anima
tion
.
backgroundColor
(
color
:
pulse
.
color
.
withAlphaComponent
(
pulse
.
opacity
/
2
),
duration
:
duration
),
forKey
:
nil
)
bLayer
.
add
(
Mo
tion
.
backgroundColor
(
color
:
pulse
.
color
.
withAlphaComponent
(
pulse
.
opacity
/
2
),
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
switch
pulse
.
animation
{
switch
pulse
.
animation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
pLayer
.
add
(
Anima
tion
.
scale
(
by
:
1
,
duration
:
duration
),
forKey
:
nil
)
pLayer
.
add
(
Mo
tion
.
scale
(
by
:
1
,
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
Anima
tion
.
delay
(
time
:
duration
)
{
Mo
tion
.
delay
(
time
:
duration
)
{
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
}
}
}
}
...
@@ -123,7 +123,7 @@ internal extension Animation {
...
@@ -123,7 +123,7 @@ internal extension Animation {
return
return
}
}
Anima
tion
.
delay
(
time
:
animated
?
0
:
0.15
)
{
[
pulse
=
pulse
]
in
Mo
tion
.
delay
(
time
:
animated
?
0
:
0.15
)
{
[
pulse
=
pulse
]
in
guard
let
pLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
else
{
guard
let
pLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
else
{
return
return
}
}
...
@@ -132,20 +132,20 @@ internal extension Animation {
...
@@ -132,20 +132,20 @@ internal extension Animation {
switch
pulse
.
animation
{
switch
pulse
.
animation
{
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
:
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
:
bLayer
.
add
(
Anima
tion
.
backgroundColor
(
color
:
pulse
.
color
.
withAlphaComponent
(
0
),
duration
:
duration
),
forKey
:
nil
)
bLayer
.
add
(
Mo
tion
.
backgroundColor
(
color
:
pulse
.
color
.
withAlphaComponent
(
0
),
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
switch
pulse
.
animation
{
switch
pulse
.
animation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
pLayer
.
add
(
Anima
tion
.
animate
(
group
:
[
pLayer
.
add
(
Mo
tion
.
animate
(
group
:
[
Anima
tion
.
scale
(
by
:
.
center
==
pulse
.
animation
?
1
:
1.325
),
Mo
tion
.
scale
(
by
:
.
center
==
pulse
.
animation
?
1
:
1.325
),
Anima
tion
.
backgroundColor
(
color
:
pulse
.
color
.
withAlphaComponent
(
0
))
Mo
tion
.
backgroundColor
(
color
:
pulse
.
color
.
withAlphaComponent
(
0
))
],
duration
:
duration
),
forKey
:
nil
)
],
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
Anima
tion
.
delay
(
time
:
duration
)
{
Mo
tion
.
delay
(
time
:
duration
)
{
pLayer
.
removeFromSuperlayer
()
pLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
}
}
...
...
Sources/iOS/PulseView.swift
View file @
1ef94e71
...
@@ -72,13 +72,13 @@ open class PulseView: View {
...
@@ -72,13 +72,13 @@ open class PulseView: View {
from the center.
from the center.
*/
*/
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Anima
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Mo
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Anima
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
}
}
}
}
...
@@ -90,7 +90,7 @@ open class PulseView: View {
...
@@ -90,7 +90,7 @@ open class PulseView: View {
*/
*/
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -101,7 +101,7 @@ open class PulseView: View {
...
@@ -101,7 +101,7 @@ open class PulseView: View {
*/
*/
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -112,6 +112,6 @@ open class PulseView: View {
...
@@ -112,6 +112,6 @@ open class PulseView: View {
*/
*/
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
}
}
Sources/iOS/SnackbarController.swift
View file @
1ef94e71
...
@@ -108,7 +108,7 @@ open class SnackbarController: RootController {
...
@@ -108,7 +108,7 @@ open class SnackbarController: RootController {
*/
*/
@discardableResult
@discardableResult
open
func
animate
(
snackbar
status
:
SnackbarStatus
,
delay
:
TimeInterval
=
0
,
animations
:
((
Snackbar
)
->
Void
)?
=
nil
,
completion
:
((
Snackbar
)
->
Void
)?
=
nil
)
->
AnimationDelayCancelBlock
?
{
open
func
animate
(
snackbar
status
:
SnackbarStatus
,
delay
:
TimeInterval
=
0
,
animations
:
((
Snackbar
)
->
Void
)?
=
nil
,
completion
:
((
Snackbar
)
->
Void
)?
=
nil
)
->
AnimationDelayCancelBlock
?
{
return
Anima
tion
.
delay
(
time
:
delay
)
{
[
weak
self
,
status
=
status
,
animations
=
animations
,
completion
=
completion
]
in
return
Mo
tion
.
delay
(
time
:
delay
)
{
[
weak
self
,
status
=
status
,
animations
=
animations
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
...
...
Sources/iOS/TableViewCell.swift
View file @
1ef94e71
...
@@ -122,13 +122,13 @@ open class TableViewCell: UITableViewCell {
...
@@ -122,13 +122,13 @@ open class TableViewCell: UITableViewCell {
from the center.
from the center.
*/
*/
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
open
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
p
,
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Anima
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Mo
tion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Anima
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulse
:
&
s
.
pulse
)
}
}
}
}
...
@@ -140,7 +140,7 @@ open class TableViewCell: UITableViewCell {
...
@@ -140,7 +140,7 @@ open class TableViewCell: UITableViewCell {
*/
*/
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Anima
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
Mo
tion
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -151,7 +151,7 @@ open class TableViewCell: UITableViewCell {
...
@@ -151,7 +151,7 @@ open class TableViewCell: UITableViewCell {
*/
*/
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
/**
/**
...
@@ -162,7 +162,7 @@ open class TableViewCell: UITableViewCell {
...
@@ -162,7 +162,7 @@ open class TableViewCell: UITableViewCell {
*/
*/
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Anima
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
Mo
tion
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulse
:
&
pulse
)
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment