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
b9f7bf00
Unverified
Commit
b9f7bf00
authored
Jan 09, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added fade to MotionAnimation
parent
00a46e33
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
+10
-13
Sources/iOS/BasicMotion.swift
+0
-0
Sources/iOS/KeyframeMotion.swift
+1
-1
Sources/iOS/PulseMotion.swift
+9
-12
No files found.
Sources/iOS/BasicMotion.swift
View file @
b9f7bf00
This diff is collapsed.
Click to expand it.
Sources/iOS/KeyframeMotion.swift
View file @
b9f7bf00
...
@@ -63,7 +63,7 @@ extension Motion {
...
@@ -63,7 +63,7 @@ extension Motion {
*/
*/
public
static
func
path
(
bezierPath
:
UIBezierPath
,
mode
:
AnimationRotationMode
=
.
auto
,
duration
:
CFTimeInterval
?
=
nil
)
->
CAKeyframeAnimation
{
public
static
func
path
(
bezierPath
:
UIBezierPath
,
mode
:
AnimationRotationMode
=
.
auto
,
duration
:
CFTimeInterval
?
=
nil
)
->
CAKeyframeAnimation
{
let
animation
=
CAKeyframeAnimation
()
let
animation
=
CAKeyframeAnimation
()
animation
.
keyPath
=
AnimationKeyPath
.
position
.
rawValue
animation
.
keyPath
=
Motion
AnimationKeyPath
.
position
.
rawValue
animation
.
path
=
bezierPath
.
cgPath
animation
.
path
=
bezierPath
.
cgPath
animation
.
rotationMode
=
AnimationRotationModeToValue
(
mode
:
mode
)
animation
.
rotationMode
=
AnimationRotationModeToValue
(
mode
:
mode
)
...
...
Sources/iOS/PulseMotion.swift
View file @
b9f7bf00
...
@@ -72,7 +72,7 @@ public struct PulseMotion {
...
@@ -72,7 +72,7 @@ public struct PulseMotion {
/// The opcaity value for the pulse animation.
/// The opcaity value for the pulse animation.
public
var
opacity
:
CGFloat
=
0.18
public
var
opacity
:
CGFloat
=
0.18
/**
/**
An initializer that takes a given view and pulse layer.
An initializer that takes a given view and pulse layer.
- Parameter pulseView: An optional UIView.
- Parameter pulseView: An optional UIView.
...
@@ -113,7 +113,7 @@ extension PulseMotion {
...
@@ -113,7 +113,7 @@ extension PulseMotion {
layers
.
insert
(
bLayer
,
at
:
0
)
layers
.
insert
(
bLayer
,
at
:
0
)
layer
.
masksToBounds
=
!
(
.
centerRadialBeyondBounds
==
animation
||
.
radialBeyondBounds
==
animation
)
layer
.
masksToBounds
=
!
(
.
centerRadialBeyondBounds
==
animation
||
.
radialBeyondBounds
==
animation
)
let
w
=
view
.
bounds
.
width
let
w
=
view
.
bounds
.
width
let
h
=
view
.
bounds
.
height
let
h
=
view
.
bounds
.
height
...
@@ -146,24 +146,24 @@ extension PulseMotion {
...
@@ -146,24 +146,24 @@ extension PulseMotion {
switch
animation
{
switch
animation
{
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
,
.
tap
:
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
,
.
tap
:
bLayer
.
add
(
Motion
.
background
(
color
:
color
.
withAlphaComponent
(
opacity
/
2
),
duration
:
duration
),
forKey
:
nil
)
bLayer
.
motion
(
duration
:
duration
,
animations
:
.
background
(
color
:
color
.
withAlphaComponent
(
opacity
/
2
))
)
default
:
break
default
:
break
}
}
switch
animation
{
switch
animation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
pLayer
.
add
(
Motion
.
scale
(
by
:
1
,
duration
:
duration
),
forKey
:
nil
)
pLayer
.
motion
(
duration
:
duration
,
animations
:
.
scale
(
by
:
1
)
)
default
:
break
default
:
break
}
}
Motion
.
delay
(
time
:
duration
)
{
Motion
.
delay
(
time
:
duration
)
{
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
}
}
}
}
}
}
extension
PulseMotion
{
extension
PulseMotion
{
/// Triggers the contracting animation.
/// Triggers the contracting animation.
public
mutating
func
contract
()
{
public
mutating
func
contract
()
{
guard
let
bLayer
=
layers
.
popLast
()
else
{
guard
let
bLayer
=
layers
.
popLast
()
else
{
return
return
...
@@ -182,16 +182,13 @@ extension PulseMotion {
...
@@ -182,16 +182,13 @@ extension PulseMotion {
switch
animation
{
switch
animation
{
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
,
.
tap
:
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
,
.
tap
:
bLayer
.
add
(
Motion
.
background
(
color
:
color
.
withAlphaComponent
(
0
),
duration
:
duration
),
forKey
:
nil
)
bLayer
.
motion
(
duration
:
duration
,
animations
:
.
background
(
color
:
color
.
withAlphaComponent
(
0
))
)
default
:
break
default
:
break
}
}
switch
animation
{
switch
animation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
pLayer
.
add
(
Motion
.
animate
(
group
:
[
pLayer
.
motion
(
duration
:
duration
,
animations
:
.
scale
(
by
:
.
center
==
animation
?
1
:
1.325
),
.
background
(
color
:
color
.
withAlphaComponent
(
0
)))
Motion
.
scale
(
by
:
.
center
==
animation
?
1
:
1.325
),
Motion
.
background
(
color
:
color
.
withAlphaComponent
(
0
))
],
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
...
@@ -200,5 +197,5 @@ extension PulseMotion {
...
@@ -200,5 +197,5 @@ extension PulseMotion {
bLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
}
}
}
}
}
}
}
}
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