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
09446a7f
Commit
09446a7f
authored
Oct 05, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding ImageCardView
parent
63296568
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
240 additions
and
52 deletions
+240
-52
MaterialKit.xcodeproj/project.pbxproj
+4
-0
Source/ImageCardView.swift
+0
-0
Source/MaterialBasicAnimation.swift
+108
-3
Source/MaterialButton.swift
+44
-25
Source/MaterialPulseView.swift
+42
-24
Source/MaterialTheme.swift
+42
-0
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
09446a7f
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
964B17D51BBB31C2002A9CA0
/* MaterialAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1731BB8D443006F7F2B
/* MaterialAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
964B17D51BBB31C2002A9CA0
/* MaterialAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1731BB8D443006F7F2B
/* MaterialAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
964B17D61BBB31C2002A9CA0
/* MaterialLayout.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
964B17B31BBA447F002A9CA0
/* MaterialLayout.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
964B17D61BBB31C2002A9CA0
/* MaterialLayout.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
964B17B31BBA447F002A9CA0
/* MaterialLayout.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
964B17D91BBB3911002A9CA0
/* BasicCardView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
964B17D91BBB3911002A9CA0
/* BasicCardView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
96D26BFD1BC23649006478BD
/* ImageCardView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D26BFC1BC23649006478BD
/* ImageCardView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
9A94D0FA1B895EA500F586A5
/* LICENSE in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832631B88E5BF0015F710
/* LICENSE */
;
};
9A94D0FA1B895EA500F586A5
/* LICENSE in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832631B88E5BF0015F710
/* LICENSE */
;
};
9A94D0FB1B895EA500F586A5
/* Roboto-Regular.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9AAC38591B8956E300FE6B2D
/* Roboto-Regular.ttf */
;
};
9A94D0FB1B895EA500F586A5
/* Roboto-Regular.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9AAC38591B8956E300FE6B2D
/* Roboto-Regular.ttf */
;
};
9A94D0FC1B895EA500F586A5
/* Roboto-Medium.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9AAC38571B8956CF00FE6B2D
/* Roboto-Medium.ttf */
;
};
9A94D0FC1B895EA500F586A5
/* Roboto-Medium.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9AAC38571B8956CF00FE6B2D
/* Roboto-Medium.ttf */
;
};
...
@@ -108,6 +109,7 @@
...
@@ -108,6 +109,7 @@
964B17B31BBA447F002A9CA0
/* MaterialLayout.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialLayout.swift
;
sourceTree
=
"<group>"
;
};
964B17B31BBA447F002A9CA0
/* MaterialLayout.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialLayout.swift
;
sourceTree
=
"<group>"
;
};
964B17B51BBA4BEA002A9CA0
/* MaterialStatusBarStyle.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialStatusBarStyle.swift
;
sourceTree
=
"<group>"
;
};
964B17B51BBA4BEA002A9CA0
/* MaterialStatusBarStyle.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialStatusBarStyle.swift
;
sourceTree
=
"<group>"
;
};
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BasicCardView.swift
;
sourceTree
=
"<group>"
;
};
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BasicCardView.swift
;
sourceTree
=
"<group>"
;
};
96D26BFC1BC23649006478BD
/* ImageCardView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ImageCardView.swift
;
sourceTree
=
"<group>"
;
};
9AAC38551B8956C500FE6B2D
/* Roboto-Light.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Light.ttf"
;
sourceTree
=
"<group>"
;
};
9AAC38551B8956C500FE6B2D
/* Roboto-Light.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Light.ttf"
;
sourceTree
=
"<group>"
;
};
9AAC38571B8956CF00FE6B2D
/* Roboto-Medium.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Medium.ttf"
;
sourceTree
=
"<group>"
;
};
9AAC38571B8956CF00FE6B2D
/* Roboto-Medium.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Medium.ttf"
;
sourceTree
=
"<group>"
;
};
9AAC38591B8956E300FE6B2D
/* Roboto-Regular.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Regular.ttf"
;
sourceTree
=
"<group>"
;
};
9AAC38591B8956E300FE6B2D
/* Roboto-Regular.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Regular.ttf"
;
sourceTree
=
"<group>"
;
};
...
@@ -273,6 +275,7 @@
...
@@ -273,6 +275,7 @@
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
,
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
,
96D26BFC1BC23649006478BD
/* ImageCardView.swift */
,
);
);
name
=
Card
;
name
=
Card
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -444,6 +447,7 @@
...
@@ -444,6 +447,7 @@
65AD15EA1BC05B3A0068AF9C
/* MaterialLayer.swift in Sources */
,
65AD15EA1BC05B3A0068AF9C
/* MaterialLayer.swift in Sources */
,
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
,
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
,
964B17D91BBB3911002A9CA0
/* BasicCardView.swift in Sources */
,
964B17D91BBB3911002A9CA0
/* BasicCardView.swift in Sources */
,
96D26BFD1BC23649006478BD
/* ImageCardView.swift in Sources */
,
65BDD1591BB6FE3E006F7F2B
/* FlatButton.swift in Sources */
,
65BDD1591BB6FE3E006F7F2B
/* FlatButton.swift in Sources */
,
65BDD1791BB99C0F006F7F2B
/* RaisedButton.swift in Sources */
,
65BDD1791BB99C0F006F7F2B
/* RaisedButton.swift in Sources */
,
964B17B41BBA447F002A9CA0
/* MaterialLayout.swift in Sources */
,
964B17B41BBA447F002A9CA0
/* MaterialLayout.swift in Sources */
,
...
...
Source/ImageCardView.swift
0 → 100644
View file @
09446a7f
This diff is collapsed.
Click to expand it.
Source/MaterialBasicAnimation.swift
View file @
09446a7f
...
@@ -67,10 +67,115 @@ public extension MaterialAnimation {
...
@@ -67,10 +67,115 @@ public extension MaterialAnimation {
/**
/**
:name: scale
:name: scale
*/
*/
public
static
func
scale
(
transform
:
CATransform3D
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
scale
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
animation
.
keyPath
=
"transform"
animation
.
keyPath
=
"transform.scale"
animation
.
toValue
=
NSValue
(
CATransform3D
:
transform
)
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
if
let
d
=
duration
{
animation
.
duration
=
d
}
return
animation
}
/**
:name: scaleX
*/
public
static
func
scaleX
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
animation
.
keyPath
=
"transform.scale.x"
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
if
let
d
=
duration
{
animation
.
duration
=
d
}
return
animation
}
/**
:name: scaleY
*/
public
static
func
scaleY
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
animation
.
keyPath
=
"transform.scale.y"
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
if
let
d
=
duration
{
animation
.
duration
=
d
}
return
animation
}
/**
:name: scaleZ
*/
public
static
func
scaleZ
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
animation
.
keyPath
=
"transform.scale.z"
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
if
let
d
=
duration
{
animation
.
duration
=
d
}
return
animation
}
/**
:name: translation
*/
public
static
func
translation
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
animation
.
keyPath
=
"transform.translation"
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
if
let
d
=
duration
{
animation
.
duration
=
d
}
return
animation
}
/**
:name: translationX
*/
public
static
func
translationX
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
animation
.
keyPath
=
"transform.translation.x"
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
if
let
d
=
duration
{
animation
.
duration
=
d
}
return
animation
}
/**
:name: translationY
*/
public
static
func
translationY
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
animation
.
keyPath
=
"transform.translation.y"
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
if
let
d
=
duration
{
animation
.
duration
=
d
}
return
animation
}
/**
:name: translationZ
*/
public
static
func
translationZ
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
()
animation
.
keyPath
=
"transform.translation.z"
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
Forwards
)
animation
.
removedOnCompletion
=
false
animation
.
removedOnCompletion
=
false
if
let
d
=
duration
{
if
let
d
=
duration
{
...
...
Source/MaterialButton.swift
View file @
09446a7f
...
@@ -20,11 +20,6 @@ import UIKit
...
@@ -20,11 +20,6 @@ import UIKit
public
class
MaterialButton
:
UIButton
{
public
class
MaterialButton
:
UIButton
{
/**
/**
:name: spotlight
*/
public
lazy
var
spotlight
:
Bool
=
false
/**
:name: visualLayer
:name: visualLayer
*/
*/
public
private(set)
lazy
var
visualLayer
:
CAShapeLayer
=
CAShapeLayer
()
public
private(set)
lazy
var
visualLayer
:
CAShapeLayer
=
CAShapeLayer
()
...
@@ -40,9 +35,26 @@ public class MaterialButton : UIButton {
...
@@ -40,9 +35,26 @@ public class MaterialButton : UIButton {
public
lazy
var
pulseScale
:
Bool
=
true
public
lazy
var
pulseScale
:
Bool
=
true
/**
/**
:name: spotlight
*/
public
var
spotlight
:
Bool
=
false
{
didSet
{
if
spotlight
{
pulseFill
=
false
}
}
}
/**
:name: pulseFill
:name: pulseFill
*/
*/
public
lazy
var
pulseFill
:
Bool
=
false
public
var
pulseFill
:
Bool
=
false
{
didSet
{
if
pulseFill
{
spotlight
=
false
}
}
}
/**
/**
:name: pulseColorOpacity
:name: pulseColorOpacity
...
@@ -385,26 +397,25 @@ public class MaterialButton : UIButton {
...
@@ -385,26 +397,25 @@ public class MaterialButton : UIButton {
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
true
==
layer
.
containsPoint
(
point
)
{
if
true
==
layer
.
containsPoint
(
point
)
{
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
f
:
CGFloat
=
3
let
f
:
CGFloat
=
4
let
v
:
CGFloat
=
s
/
f
let
v
:
CGFloat
=
s
/
f
let
d
:
CGFloat
=
pulseFill
?
5
*
f
:
2
*
f
let
d
:
CGFloat
=
2
*
f
let
r
:
CGFloat
=
1.05
let
r
:
CGFloat
=
1.05
let
a
:
CFTimeInterval
=
0.25
let
t
:
CFTimeInterval
=
0.25
MaterialAnimation
.
animationDisabled
({
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
self
.
pulseLayer
.
hidden
=
false
MaterialAnimation
.
animationDisabled
({
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
cornerRadius
=
s
/
d
self
.
pulseLayer
.
position
=
point
})
self
.
pulseLayer
.
cornerRadius
=
s
/
d
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
pulseFill
?
3
*
d
:
1.5
*
d
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
CATransform3DMakeScale
(
r
,
r
,
r
),
duration
:
a
),
forKey
:
nil
)
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
r
,
duration
:
t
),
forKey
:
nil
)
}
}
MaterialAnimation
.
animationWithDuration
(
a
,
animations
:
{
self
.
pulseLayer
.
transform
=
CATransform3DMakeScale
(
d
,
d
,
d
)
})
}
}
}
}
...
@@ -480,10 +491,17 @@ public class MaterialButton : UIButton {
...
@@ -480,10 +491,17 @@ public class MaterialButton : UIButton {
// :name: shrink
// :name: shrink
//
//
internal
func
shrink
()
{
internal
func
shrink
()
{
MaterialAnimation
.
animationWithDuration
(
0.25
,
animations
:
{
let
t
:
CFTimeInterval
=
0.25
self
.
pulseLayer
.
hidden
=
true
self
.
pulseLayer
.
transform
=
CATransform3DIdentity
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
})
MaterialAnimation
.
animationWithDuration
(
t
,
animations
:
{
self
.
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
CATransform3DIdentity
),
forKey
:
nil
)
self
.
pulseLayer
.
hidden
=
true
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
}
}
}
}
}
\ No newline at end of file
Source/MaterialPulseView.swift
View file @
09446a7f
...
@@ -20,11 +20,6 @@ import UIKit
...
@@ -20,11 +20,6 @@ import UIKit
public
class
MaterialPulseView
:
MaterialView
{
public
class
MaterialPulseView
:
MaterialView
{
/**
/**
:name: spotlight
*/
public
lazy
var
spotlight
:
Bool
=
false
/**
:name: pulseLayer
:name: pulseLayer
*/
*/
public
private(set)
lazy
var
pulseLayer
:
CAShapeLayer
=
CAShapeLayer
()
public
private(set)
lazy
var
pulseLayer
:
CAShapeLayer
=
CAShapeLayer
()
...
@@ -35,9 +30,26 @@ public class MaterialPulseView : MaterialView {
...
@@ -35,9 +30,26 @@ public class MaterialPulseView : MaterialView {
public
lazy
var
pulseScale
:
Bool
=
true
public
lazy
var
pulseScale
:
Bool
=
true
/**
/**
:name: spotlight
*/
public
var
spotlight
:
Bool
=
false
{
didSet
{
if
spotlight
{
pulseFill
=
false
}
}
}
/**
:name: pulseFill
:name: pulseFill
*/
*/
public
lazy
var
pulseFill
:
Bool
=
false
public
var
pulseFill
:
Bool
=
false
{
didSet
{
if
pulseFill
{
spotlight
=
false
}
}
}
/**
/**
:name: pulseColorOpacity
:name: pulseColorOpacity
...
@@ -67,24 +79,23 @@ public class MaterialPulseView : MaterialView {
...
@@ -67,24 +79,23 @@ public class MaterialPulseView : MaterialView {
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
f
:
CGFloat
=
3
let
f
:
CGFloat
=
3
let
v
:
CGFloat
=
s
/
f
let
v
:
CGFloat
=
s
/
f
let
d
:
CGFloat
=
pulseFill
?
5
*
f
:
2
*
f
let
d
:
CGFloat
=
2
*
f
let
r
:
CGFloat
=
1.05
let
r
:
CGFloat
=
1.05
let
a
:
CFTimeInterval
=
0.25
let
t
:
CFTimeInterval
=
0.25
MaterialAnimation
.
animationDisabled
({
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
self
.
pulseLayer
.
hidden
=
false
MaterialAnimation
.
animationDisabled
({
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
cornerRadius
=
s
/
d
self
.
pulseLayer
.
position
=
point
})
self
.
pulseLayer
.
cornerRadius
=
s
/
d
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
pulseFill
?
3
*
d
:
d
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
CATransform3DMakeScale
(
r
,
r
,
r
),
duration
:
a
),
forKey
:
nil
)
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
r
,
duration
:
t
),
forKey
:
nil
)
}
}
MaterialAnimation
.
animationWithDuration
(
a
,
animations
:
{
self
.
pulseLayer
.
transform
=
CATransform3DMakeScale
(
d
,
d
,
d
)
})
}
}
}
}
...
@@ -164,10 +175,17 @@ public class MaterialPulseView : MaterialView {
...
@@ -164,10 +175,17 @@ public class MaterialPulseView : MaterialView {
// :name: shrink
// :name: shrink
//
//
internal
func
shrink
()
{
internal
func
shrink
()
{
MaterialAnimation
.
animationWithDuration
(
0.25
,
animations
:
{
let
t
:
NSTimeInterval
=
0.25
self
.
pulseLayer
.
hidden
=
true
self
.
pulseLayer
.
transform
=
CATransform3DIdentity
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
})
MaterialAnimation
.
animationWithDuration
(
t
,
animations
:
{
self
.
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
CATransform3DIdentity
),
forKey
:
nil
)
self
.
pulseLayer
.
hidden
=
true
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
}
}
}
}
}
Source/MaterialTheme.swift
View file @
09446a7f
...
@@ -22,6 +22,7 @@ public struct MaterialTheme {
...
@@ -22,6 +22,7 @@ public struct MaterialTheme {
public
struct
view
{}
public
struct
view
{}
public
struct
pulseView
{}
public
struct
pulseView
{}
public
struct
basicCardView
{}
public
struct
basicCardView
{}
public
struct
imageCardView
{}
public
struct
navigationBarView
{}
public
struct
navigationBarView
{}
public
struct
label
{}
public
struct
label
{}
public
struct
flatButton
{}
public
struct
flatButton
{}
...
@@ -132,6 +133,47 @@ public extension MaterialTheme.basicCardView {
...
@@ -132,6 +133,47 @@ public extension MaterialTheme.basicCardView {
public
static
var
dividerColor
:
UIColor
=
MaterialColor
.
blueGrey
.
lighten5
public
static
var
dividerColor
:
UIColor
=
MaterialColor
.
blueGrey
.
lighten5
}
}
// imageCardView
public
extension
MaterialTheme
.
imageCardView
{
// shadow
public
static
var
shadowDepth
:
MaterialDepth
=
.
Depth2
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
true
public
static
var
cornerRadius
:
MaterialRadius
=
.
None
public
static
var
contentInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square3
)
public
static
var
titleLabelInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square2
)
public
static
var
detailLabelInsetsRef
:
MaterialInsetsType
=
(
top
:
0
,
left
:
8
,
bottom
:
16
,
right
:
8
)
public
static
var
leftButtonsInsetsRef
:
MaterialInsetsType
=
(
top
:
8
,
left
:
8
,
bottom
:
-
8
,
right
:
0
)
public
static
var
rightButtonsInsetsRef
:
MaterialInsetsType
=
(
top
:
8
,
left
:
0
,
bottom
:
-
8
,
right
:
8
)
// border
public
static
var
borderWidth
:
MaterialBorder
=
.
None
public
static
var
bordercolor
:
UIColor
=
MaterialColor
.
black
// color
public
static
var
backgroundColor
:
UIColor
=
MaterialColor
.
white
public
static
var
pulseColor
:
UIColor
=
MaterialColor
.
white
public
static
var
pulseColorOpacity
:
CGFloat
=
0.25
// interaction
public
static
var
userInteractionEnabled
:
Bool
=
true
// image
public
static
var
contentsRect
:
CGRect
=
CGRectMake
(
0
,
0
,
1
,
1
)
public
static
var
contentsCenter
:
CGRect
=
CGRectMake
(
0
,
0
,
1
,
1
)
public
static
var
contentsScale
:
CGFloat
=
UIScreen
.
mainScreen
()
.
scale
public
static
var
contentsGravity
:
MaterialGravity
=
.
ResizeAspectFill
// position
public
static
var
zPosition
:
CGFloat
=
0
// divider
public
static
var
divider
:
Bool
=
true
public
static
var
dividerColor
:
UIColor
=
MaterialColor
.
blueGrey
.
lighten5
}
// navigationBarView
// navigationBarView
public
extension
MaterialTheme
.
navigationBarView
{
public
extension
MaterialTheme
.
navigationBarView
{
// frame
// frame
...
...
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