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
1fbf4870
Commit
1fbf4870
authored
Oct 19, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated animation for SideNavigationViewController
parent
44b579be
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
10 deletions
+27
-10
Source/MaterialAnimation.swift
+1
-0
Source/MaterialBasicAnimation.swift
+16
-0
Source/MaterialPanCollectionViewCell.swift
+1
-3
Source/SideNavigationViewController.swift
+9
-7
No files found.
Source/MaterialAnimation.swift
View file @
1fbf4870
...
...
@@ -78,6 +78,7 @@ public struct MaterialAnimation {
group
.
removedOnCompletion
=
false
group
.
animations
=
animations
group
.
duration
=
duration
group
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
return
group
}
}
Source/MaterialBasicAnimation.swift
View file @
1fbf4870
...
...
@@ -28,6 +28,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
color
.
CGColor
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -43,6 +44,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
radius
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -58,6 +60,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
NSValue
(
CATransform3D
:
transform
)
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -73,6 +76,7 @@ public extension MaterialAnimation {
animation
.
byValue
=
(
M_PI
*
2
*
rotations
)
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -88,6 +92,7 @@ public extension MaterialAnimation {
animation
.
byValue
=
(
M_PI_4
*
rotations
)
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -103,6 +108,7 @@ public extension MaterialAnimation {
animation
.
byValue
=
(
M_PI_4
*
rotations
)
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -118,6 +124,7 @@ public extension MaterialAnimation {
animation
.
byValue
=
(
M_PI_4
*
rotations
)
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -133,6 +140,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -148,6 +156,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -163,6 +172,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -178,6 +188,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -193,6 +204,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
NSValue
(
CGSize
:
translation
)
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -208,6 +220,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -223,6 +236,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -238,6 +252,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
@@ -253,6 +268,7 @@ public extension MaterialAnimation {
animation
.
toValue
=
NSValue
(
CGPoint
:
point
)
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
d
=
duration
{
animation
.
duration
=
d
}
...
...
Source/MaterialPanCollectionViewCell.swift
View file @
1fbf4870
...
...
@@ -164,9 +164,7 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
revealed
=
false
// snap back
let
a
:
CABasicAnimation
=
MaterialAnimation
.
position
(
CGPointMake
(
width
/
2
,
y
+
height
/
2
),
duration
:
0.25
)
a
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
(
a
)
animation
(
MaterialAnimation
.
position
(
CGPointMake
(
width
/
2
,
y
+
height
/
2
),
duration
:
0.25
))
if
leftOnDragRelease
{
(
delegate
as?
MaterialPanCollectionViewCellDelegate
)?
.
materialCollectionViewCellDidCloseLeftLayer
?(
self
)
...
...
Source/SideNavigationViewController.swift
View file @
1fbf4870
...
...
@@ -179,24 +179,25 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
layoutBackdropLayer
()
if
let
v
:
MaterialView
=
leftView
{
leftViewController
?
.
view
.
frame
=
v
.
bounds
leftViewController
?
.
view
.
center
=
CGPointMake
(
v
.
width
/
2
,
v
.
height
/
2
)
}
}
/**
:name: setLeftViewControllerWidth
*/
public
func
setLeftViewControllerWidth
(
width
:
CGFloat
,
hidden
:
Bool
,
animated
:
Bool
,
duration
:
CFTimeInterval
=
0.25
)
{
public
func
setLeftViewControllerWidth
(
width
:
CGFloat
,
hidden
:
Bool
,
animated
:
Bool
)
{
leftViewControllerWidth
=
width
MaterialAnimation
.
animationDisabled
({
self
.
leftView
!.
width
=
width
})
let
w
:
CGFloat
=
(
hidden
?
-
width
:
width
)
/
2
if
animated
{
leftView
!.
animation
(
MaterialAnimation
.
position
(
CGPointMake
((
hidden
?
-
width
:
width
)
/
2
,
leftView
!.
position
.
y
),
duration
:
duration
))
self
.
leftView
!.
width
=
width
self
.
leftView
!.
position
.
x
=
w
}
else
{
MaterialAnimation
.
animationDisabled
({
self
.
leftView
!.
position
.
x
=
(
hidden
?
-
width
:
width
)
/
2
self
.
leftView
!.
width
=
width
self
.
leftView
!.
position
.
x
=
w
})
}
}
...
...
@@ -283,10 +284,11 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
internal
func
prepareLeftView
()
{
// container
leftView
=
MaterialView
(
frame
:
CGRectMake
(
0
,
0
,
leftViewControllerWidth
,
view
.
frame
.
height
))
leftView
!.
backgroundColor
=
MaterialColor
.
clear
view
.
addSubview
(
leftView
!
)
MaterialAnimation
.
animationDisabled
({
self
.
leftView
!.
position
=
CGPointMake
(
-
self
.
leftView
!.
width
/
2
,
self
.
leftView
!.
height
/
2
)
self
.
leftView
!.
position
.
x
=
-
self
.
leftViewControllerWidth
/
2
self
.
leftView
!.
zPosition
=
1000
})
...
...
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