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
e15b9fff
Commit
e15b9fff
authored
Jul 16, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup and removal of duplicate code
parent
454b272a
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
342 additions
and
266 deletions
+342
-266
Material.xcodeproj/project.pbxproj
+33
-33
Sources/OSX/Color.swift
+42
-40
Sources/iOS/AnimateKeyframe.swift
+7
-7
Sources/iOS/Animation.swift
+26
-32
Sources/iOS/BasicAnimation.swift
+39
-39
Sources/iOS/Button.swift
+7
-7
Sources/iOS/Capture.swift
+15
-6
Sources/iOS/Card.swift
+1
-1
Sources/iOS/Color.swift
+10
-10
Sources/iOS/FabButton.swift
+2
-2
Sources/iOS/FlatButton.swift
+1
-1
Sources/iOS/IconButton.swift
+1
-1
Sources/iOS/ImageCard.swift
+1
-1
Sources/iOS/KeyframeAnimation.swift
+67
-0
Sources/iOS/Layer.swift
+3
-3
Sources/iOS/MaterialCollectionReusableView.swift
+13
-13
Sources/iOS/MaterialCollectionView.swift
+6
-6
Sources/iOS/MaterialCollectionViewCell.swift
+14
-14
Sources/iOS/MaterialCollectionViewDataSource.swift
+2
-2
Sources/iOS/MaterialCollectionViewDelegate.swift
+1
-1
Sources/iOS/MaterialCollectionViewLayout.swift
+1
-1
Sources/iOS/MaterialTableViewCell.swift
+8
-8
Sources/iOS/PulseAnimation.swift
+20
-16
Sources/iOS/PulseView.swift
+6
-6
Sources/iOS/RaisedButton.swift
+1
-1
Sources/iOS/TextView.swift
+2
-2
Sources/iOS/TransitionAnimation.swift
+12
-12
Sources/iOS/View.swift
+1
-1
No files found.
Material.xcodeproj/project.pbxproj
View file @
e15b9fff
...
@@ -41,8 +41,8 @@
...
@@ -41,8 +41,8 @@
96BCB7B31CB40DC500C806FE
/* Material+UIImage+Resize.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76A1CB40DC500C806FE
/* Material+UIImage+Resize.swift */
;
};
96BCB7B31CB40DC500C806FE
/* Material+UIImage+Resize.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76A1CB40DC500C806FE
/* Material+UIImage+Resize.swift */
;
};
96BCB7B41CB40DC500C806FE
/* Material+UIImage+Size.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76B1CB40DC500C806FE
/* Material+UIImage+Size.swift */
;
};
96BCB7B41CB40DC500C806FE
/* Material+UIImage+Size.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76B1CB40DC500C806FE
/* Material+UIImage+Size.swift */
;
};
96BCB7B51CB40DC500C806FE
/* Material+UIImage.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76C1CB40DC500C806FE
/* Material+UIImage.swift */
;
};
96BCB7B51CB40DC500C806FE
/* Material+UIImage.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76C1CB40DC500C806FE
/* Material+UIImage.swift */
;
};
96BCB7B61CB40DC500C806FE
/*
MaterialAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76D1CB40DC500C806FE
/* Material
Animation.swift */
;
};
96BCB7B61CB40DC500C806FE
/*
Animation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76D1CB40DC500C806FE
/*
Animation.swift */
;
};
96BCB7B71CB40DC500C806FE
/*
MaterialBasicAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76E1CB40DC500C806FE
/* Material
BasicAnimation.swift */
;
};
96BCB7B71CB40DC500C806FE
/*
BasicAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76E1CB40DC500C806FE
/*
BasicAnimation.swift */
;
};
96BCB7B81CB40DC500C806FE
/* Border.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76F1CB40DC500C806FE
/* Border.swift */
;
};
96BCB7B81CB40DC500C806FE
/* Border.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76F1CB40DC500C806FE
/* Border.swift */
;
};
96BCB7B91CB40DC500C806FE
/* Button.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7701CB40DC500C806FE
/* Button.swift */
;
};
96BCB7B91CB40DC500C806FE
/* Button.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7701CB40DC500C806FE
/* Button.swift */
;
};
96BCB7BA1CB40DC500C806FE
/* MaterialCollectionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7711CB40DC500C806FE
/* MaterialCollectionView.swift */
;
};
96BCB7BA1CB40DC500C806FE
/* MaterialCollectionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7711CB40DC500C806FE
/* MaterialCollectionView.swift */
;
};
...
@@ -58,11 +58,11 @@
...
@@ -58,11 +58,11 @@
96BCB7C41CB40DC500C806FE
/* Font.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77B1CB40DC500C806FE
/* Font.swift */
;
};
96BCB7C41CB40DC500C806FE
/* Font.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77B1CB40DC500C806FE
/* Font.swift */
;
};
96BCB7C51CB40DC500C806FE
/* MaterialGravity.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77C1CB40DC500C806FE
/* MaterialGravity.swift */
;
};
96BCB7C51CB40DC500C806FE
/* MaterialGravity.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77C1CB40DC500C806FE
/* MaterialGravity.swift */
;
};
96BCB7C61CB40DC500C806FE
/* Icon.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77D1CB40DC500C806FE
/* Icon.swift */
;
};
96BCB7C61CB40DC500C806FE
/* Icon.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77D1CB40DC500C806FE
/* Icon.swift */
;
};
96BCB7C71CB40DC500C806FE
/*
MaterialKeyframeAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77E1CB40DC500C806FE
/* Material
KeyframeAnimation.swift */
;
};
96BCB7C71CB40DC500C806FE
/*
KeyframeAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77E1CB40DC500C806FE
/*
KeyframeAnimation.swift */
;
};
96BCB7C81CB40DC500C806FE
/* MaterialLabel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77F1CB40DC500C806FE
/* MaterialLabel.swift */
;
};
96BCB7C81CB40DC500C806FE
/* MaterialLabel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77F1CB40DC500C806FE
/* MaterialLabel.swift */
;
};
96BCB7C91CB40DC500C806FE
/* Layer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7801CB40DC500C806FE
/* Layer.swift */
;
};
96BCB7C91CB40DC500C806FE
/* Layer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7801CB40DC500C806FE
/* Layer.swift */
;
};
96BCB7CA1CB40DC500C806FE
/* Layout.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7811CB40DC500C806FE
/* Layout.swift */
;
};
96BCB7CA1CB40DC500C806FE
/* Layout.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7811CB40DC500C806FE
/* Layout.swift */
;
};
96BCB7CB1CB40DC500C806FE
/*
MaterialPulseAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/* Material
PulseAnimation.swift */
;
};
96BCB7CB1CB40DC500C806FE
/*
PulseAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/*
PulseAnimation.swift */
;
};
96BCB7CD1CB40DC500C806FE
/* PulseView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7841CB40DC500C806FE
/* PulseView.swift */
;
};
96BCB7CD1CB40DC500C806FE
/* PulseView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7841CB40DC500C806FE
/* PulseView.swift */
;
};
96BCB7CE1CB40DC500C806FE
/* CornerRadius.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7851CB40DC500C806FE
/* CornerRadius.swift */
;
};
96BCB7CE1CB40DC500C806FE
/* CornerRadius.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7851CB40DC500C806FE
/* CornerRadius.swift */
;
};
96BCB7CF1CB40DC500C806FE
/* Shape.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7861CB40DC500C806FE
/* Shape.swift */
;
};
96BCB7CF1CB40DC500C806FE
/* Shape.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7861CB40DC500C806FE
/* Shape.swift */
;
};
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
96BCB7D11CB40DC500C806FE
/* Switch.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7881CB40DC500C806FE
/* Switch.swift */
;
};
96BCB7D11CB40DC500C806FE
/* Switch.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7881CB40DC500C806FE
/* Switch.swift */
;
};
96BCB7D21CB40DC500C806FE
/* MaterialTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7891CB40DC500C806FE
/* MaterialTableViewCell.swift */
;
};
96BCB7D21CB40DC500C806FE
/* MaterialTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7891CB40DC500C806FE
/* MaterialTableViewCell.swift */
;
};
96BCB7D31CB40DC500C806FE
/* MaterialTextLayer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78A1CB40DC500C806FE
/* MaterialTextLayer.swift */
;
};
96BCB7D31CB40DC500C806FE
/* MaterialTextLayer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78A1CB40DC500C806FE
/* MaterialTextLayer.swift */
;
};
96BCB7D41CB40DC500C806FE
/*
MaterialTransitionAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/* Material
TransitionAnimation.swift */
;
};
96BCB7D41CB40DC500C806FE
/*
TransitionAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/*
TransitionAnimation.swift */
;
};
96BCB7D51CB40DC500C806FE
/* View.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78C1CB40DC500C806FE
/* View.swift */
;
};
96BCB7D51CB40DC500C806FE
/* View.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78C1CB40DC500C806FE
/* View.swift */
;
};
96BCB7D61CB40DC500C806FE
/* Menu.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78D1CB40DC500C806FE
/* Menu.swift */
;
};
96BCB7D61CB40DC500C806FE
/* Menu.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78D1CB40DC500C806FE
/* Menu.swift */
;
};
96BCB7D71CB40DC500C806FE
/* MenuView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78E1CB40DC500C806FE
/* MenuView.swift */
;
};
96BCB7D71CB40DC500C806FE
/* MenuView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78E1CB40DC500C806FE
/* MenuView.swift */
;
};
...
@@ -103,11 +103,11 @@
...
@@ -103,11 +103,11 @@
96BCB7FB1CB40DE900C806FE
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7F21CB40DE900C806FE
/* Roboto-Thin.ttf */
;
};
96BCB7FB1CB40DE900C806FE
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7F21CB40DE900C806FE
/* Roboto-Thin.ttf */
;
};
96BCB7FC1CB40DE900C806FE
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7F21CB40DE900C806FE
/* Roboto-Thin.ttf */
;
};
96BCB7FC1CB40DE900C806FE
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7F21CB40DE900C806FE
/* Roboto-Thin.ttf */
;
};
96BCB7FE1CB40E1D00C806FE
/* Color.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7FD1CB40E1D00C806FE
/* Color.swift */
;
};
96BCB7FE1CB40E1D00C806FE
/* Color.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7FD1CB40E1D00C806FE
/* Color.swift */
;
};
96BCB8101CB4115200C806FE
/*
MaterialTransitionAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/* Material
TransitionAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8101CB4115200C806FE
/*
TransitionAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/*
TransitionAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8111CB4115200C806FE
/*
MaterialAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76D1CB40DC500C806FE
/* Material
Animation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8111CB4115200C806FE
/*
Animation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76D1CB40DC500C806FE
/*
Animation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8121CB4115200C806FE
/*
MaterialBasicAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76E1CB40DC500C806FE
/* Material
BasicAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8121CB4115200C806FE
/*
BasicAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76E1CB40DC500C806FE
/*
BasicAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8131CB4115200C806FE
/*
MaterialKeyframeAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77E1CB40DC500C806FE
/* Material
KeyframeAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8131CB4115200C806FE
/*
KeyframeAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77E1CB40DC500C806FE
/*
KeyframeAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8141CB4115200C806FE
/*
MaterialPulseAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/* Material
PulseAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8141CB4115200C806FE
/*
PulseAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/*
PulseAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8151CB4115200C806FE
/* FabButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75F1CB40DC500C806FE
/* FabButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8151CB4115200C806FE
/* FabButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75F1CB40DC500C806FE
/* FabButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8161CB4115200C806FE
/* FlatButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7601CB40DC500C806FE
/* FlatButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8161CB4115200C806FE
/* FlatButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7601CB40DC500C806FE
/* FlatButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8171CB4115200C806FE
/* Button.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7701CB40DC500C806FE
/* Button.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8171CB4115200C806FE
/* Button.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7701CB40DC500C806FE
/* Button.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
@@ -235,8 +235,8 @@
...
@@ -235,8 +235,8 @@
96BCB76A1CB40DC500C806FE
/* Material+UIImage+Resize.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage+Resize.swift"
;
sourceTree
=
"<group>"
;
};
96BCB76A1CB40DC500C806FE
/* Material+UIImage+Resize.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage+Resize.swift"
;
sourceTree
=
"<group>"
;
};
96BCB76B1CB40DC500C806FE
/* Material+UIImage+Size.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage+Size.swift"
;
sourceTree
=
"<group>"
;
};
96BCB76B1CB40DC500C806FE
/* Material+UIImage+Size.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage+Size.swift"
;
sourceTree
=
"<group>"
;
};
96BCB76C1CB40DC500C806FE
/* Material+UIImage.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage.swift"
;
sourceTree
=
"<group>"
;
};
96BCB76C1CB40DC500C806FE
/* Material+UIImage.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage.swift"
;
sourceTree
=
"<group>"
;
};
96BCB76D1CB40DC500C806FE
/*
MaterialAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Material
Animation.swift
;
sourceTree
=
"<group>"
;
};
96BCB76D1CB40DC500C806FE
/*
Animation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Animation.swift
;
sourceTree
=
"<group>"
;
};
96BCB76E1CB40DC500C806FE
/*
MaterialBasicAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Material
BasicAnimation.swift
;
sourceTree
=
"<group>"
;
};
96BCB76E1CB40DC500C806FE
/*
BasicAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BasicAnimation.swift
;
sourceTree
=
"<group>"
;
};
96BCB76F1CB40DC500C806FE
/* Border.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Border.swift
;
sourceTree
=
"<group>"
;
};
96BCB76F1CB40DC500C806FE
/* Border.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Border.swift
;
sourceTree
=
"<group>"
;
};
96BCB7701CB40DC500C806FE
/* Button.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Button.swift
;
sourceTree
=
"<group>"
;
};
96BCB7701CB40DC500C806FE
/* Button.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Button.swift
;
sourceTree
=
"<group>"
;
};
96BCB7711CB40DC500C806FE
/* MaterialCollectionView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialCollectionView.swift
;
sourceTree
=
"<group>"
;
};
96BCB7711CB40DC500C806FE
/* MaterialCollectionView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialCollectionView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -252,11 +252,11 @@
...
@@ -252,11 +252,11 @@
96BCB77B1CB40DC500C806FE
/* Font.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Font.swift
;
sourceTree
=
"<group>"
;
};
96BCB77B1CB40DC500C806FE
/* Font.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Font.swift
;
sourceTree
=
"<group>"
;
};
96BCB77C1CB40DC500C806FE
/* MaterialGravity.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialGravity.swift
;
sourceTree
=
"<group>"
;
};
96BCB77C1CB40DC500C806FE
/* MaterialGravity.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialGravity.swift
;
sourceTree
=
"<group>"
;
};
96BCB77D1CB40DC500C806FE
/* Icon.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Icon.swift
;
sourceTree
=
"<group>"
;
};
96BCB77D1CB40DC500C806FE
/* Icon.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Icon.swift
;
sourceTree
=
"<group>"
;
};
96BCB77E1CB40DC500C806FE
/*
MaterialKeyframeAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Material
KeyframeAnimation.swift
;
sourceTree
=
"<group>"
;
};
96BCB77E1CB40DC500C806FE
/*
KeyframeAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
KeyframeAnimation.swift
;
sourceTree
=
"<group>"
;
};
96BCB77F1CB40DC500C806FE
/* MaterialLabel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialLabel.swift
;
sourceTree
=
"<group>"
;
};
96BCB77F1CB40DC500C806FE
/* MaterialLabel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialLabel.swift
;
sourceTree
=
"<group>"
;
};
96BCB7801CB40DC500C806FE
/* Layer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Layer.swift
;
sourceTree
=
"<group>"
;
};
96BCB7801CB40DC500C806FE
/* Layer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Layer.swift
;
sourceTree
=
"<group>"
;
};
96BCB7811CB40DC500C806FE
/* Layout.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Layout.swift
;
sourceTree
=
"<group>"
;
};
96BCB7811CB40DC500C806FE
/* Layout.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Layout.swift
;
sourceTree
=
"<group>"
;
};
96BCB7821CB40DC500C806FE
/*
MaterialPulseAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Material
PulseAnimation.swift
;
sourceTree
=
"<group>"
;
};
96BCB7821CB40DC500C806FE
/*
PulseAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PulseAnimation.swift
;
sourceTree
=
"<group>"
;
};
96BCB7841CB40DC500C806FE
/* PulseView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PulseView.swift
;
sourceTree
=
"<group>"
;
};
96BCB7841CB40DC500C806FE
/* PulseView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PulseView.swift
;
sourceTree
=
"<group>"
;
};
96BCB7851CB40DC500C806FE
/* CornerRadius.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CornerRadius.swift
;
sourceTree
=
"<group>"
;
};
96BCB7851CB40DC500C806FE
/* CornerRadius.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CornerRadius.swift
;
sourceTree
=
"<group>"
;
};
96BCB7861CB40DC500C806FE
/* Shape.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Shape.swift
;
sourceTree
=
"<group>"
;
};
96BCB7861CB40DC500C806FE
/* Shape.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Shape.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -264,7 +264,7 @@
...
@@ -264,7 +264,7 @@
96BCB7881CB40DC500C806FE
/* Switch.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Switch.swift
;
sourceTree
=
"<group>"
;
};
96BCB7881CB40DC500C806FE
/* Switch.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Switch.swift
;
sourceTree
=
"<group>"
;
};
96BCB7891CB40DC500C806FE
/* MaterialTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
96BCB7891CB40DC500C806FE
/* MaterialTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
96BCB78A1CB40DC500C806FE
/* MaterialTextLayer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTextLayer.swift
;
sourceTree
=
"<group>"
;
};
96BCB78A1CB40DC500C806FE
/* MaterialTextLayer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTextLayer.swift
;
sourceTree
=
"<group>"
;
};
96BCB78B1CB40DC500C806FE
/*
MaterialTransitionAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Material
TransitionAnimation.swift
;
sourceTree
=
"<group>"
;
};
96BCB78B1CB40DC500C806FE
/*
TransitionAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TransitionAnimation.swift
;
sourceTree
=
"<group>"
;
};
96BCB78C1CB40DC500C806FE
/* View.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
View.swift
;
sourceTree
=
"<group>"
;
};
96BCB78C1CB40DC500C806FE
/* View.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
View.swift
;
sourceTree
=
"<group>"
;
};
96BCB78D1CB40DC500C806FE
/* Menu.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Menu.swift
;
sourceTree
=
"<group>"
;
};
96BCB78D1CB40DC500C806FE
/* Menu.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Menu.swift
;
sourceTree
=
"<group>"
;
};
96BCB78E1CB40DC500C806FE
/* MenuView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
indentWidth
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MenuView.swift
;
sourceTree
=
"<group>"
;
tabWidth
=
4
;
};
96BCB78E1CB40DC500C806FE
/* MenuView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
indentWidth
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MenuView.swift
;
sourceTree
=
"<group>"
;
tabWidth
=
4
;
};
...
@@ -396,7 +396,7 @@
...
@@ -396,7 +396,7 @@
96BCB7571CB40DC500C806FE
/* iOS */
=
{
96BCB7571CB40DC500C806FE
/* iOS */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
96BCB8091CB4107700C806FE
/* Animat
ion
*/
,
96BCB8091CB4107700C806FE
/* Animat
e
*/
,
96BCB8031CB40F4B00C806FE
/* Button */
,
96BCB8031CB40F4B00C806FE
/* Button */
,
96BCB8021CB40F3B00C806FE
/* Card */
,
96BCB8021CB40F3B00C806FE
/* Card */
,
96BCB7FF1CB40EF000C806FE
/* Capture */
,
96BCB7FF1CB40EF000C806FE
/* Capture */
,
...
@@ -567,16 +567,16 @@
...
@@ -567,16 +567,16 @@
name
=
Icon
;
name
=
Icon
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
96BCB8091CB4107700C806FE
/* Animat
ion
*/
=
{
96BCB8091CB4107700C806FE
/* Animat
e
*/
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
96BCB7
8B1CB40DC500C806FE
/* MaterialTransition
Animation.swift */
,
96BCB7
6D1CB40DC500C806FE
/*
Animation.swift */
,
96BCB7
6D1CB40DC500C806FE
/* Material
Animation.swift */
,
96BCB7
8B1CB40DC500C806FE
/* Transition
Animation.swift */
,
96BCB76E1CB40DC500C806FE
/*
Material
BasicAnimation.swift */
,
96BCB76E1CB40DC500C806FE
/* BasicAnimation.swift */
,
96BCB77E1CB40DC500C806FE
/*
Material
KeyframeAnimation.swift */
,
96BCB77E1CB40DC500C806FE
/* KeyframeAnimation.swift */
,
96BCB7821CB40DC500C806FE
/*
Material
PulseAnimation.swift */
,
96BCB7821CB40DC500C806FE
/* PulseAnimation.swift */
,
);
);
name
=
Animat
ion
;
name
=
Animat
e
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
96BCB80A1CB410A100C806FE
/* Extension */
=
{
96BCB80A1CB410A100C806FE
/* Extension */
=
{
...
@@ -667,11 +667,11 @@
...
@@ -667,11 +667,11 @@
buildActionMask
=
2147483647
;
buildActionMask
=
2147483647
;
files
=
(
files
=
(
96D88C321C1328D800B91418
/* Material.h in Headers */
,
96D88C321C1328D800B91418
/* Material.h in Headers */
,
96BCB8101CB4115200C806FE
/*
Material
TransitionAnimation.swift in Headers */
,
96BCB8101CB4115200C806FE
/* TransitionAnimation.swift in Headers */
,
96BCB8111CB4115200C806FE
/*
Material
Animation.swift in Headers */
,
96BCB8111CB4115200C806FE
/* Animation.swift in Headers */
,
96BCB8121CB4115200C806FE
/*
Material
BasicAnimation.swift in Headers */
,
96BCB8121CB4115200C806FE
/* BasicAnimation.swift in Headers */
,
96BCB8131CB4115200C806FE
/*
Material
KeyframeAnimation.swift in Headers */
,
96BCB8131CB4115200C806FE
/* KeyframeAnimation.swift in Headers */
,
96BCB8141CB4115200C806FE
/*
Material
PulseAnimation.swift in Headers */
,
96BCB8141CB4115200C806FE
/* PulseAnimation.swift in Headers */
,
96BCB8151CB4115200C806FE
/* FabButton.swift in Headers */
,
96BCB8151CB4115200C806FE
/* FabButton.swift in Headers */
,
96BCB8161CB4115200C806FE
/* FlatButton.swift in Headers */
,
96BCB8161CB4115200C806FE
/* FlatButton.swift in Headers */
,
96BCB8171CB4115200C806FE
/* Button.swift in Headers */
,
96BCB8171CB4115200C806FE
/* Button.swift in Headers */
,
...
@@ -941,7 +941,7 @@
...
@@ -941,7 +941,7 @@
96BCB7A31CB40DC500C806FE
/* CapturePreview.swift in Sources */
,
96BCB7A31CB40DC500C806FE
/* CapturePreview.swift in Sources */
,
96BCB7BC1CB40DC500C806FE
/* MaterialCollectionViewDataSource.swift in Sources */
,
96BCB7BC1CB40DC500C806FE
/* MaterialCollectionViewDataSource.swift in Sources */
,
96E3C3941D397AE90086A024
/* Material.swift in Sources */
,
96E3C3941D397AE90086A024
/* Material.swift in Sources */
,
96BCB7C71CB40DC500C806FE
/*
Material
KeyframeAnimation.swift in Sources */
,
96BCB7C71CB40DC500C806FE
/* KeyframeAnimation.swift in Sources */
,
96BCB7BE1CB40DC500C806FE
/* MaterialCollectionViewLayout.swift in Sources */
,
96BCB7BE1CB40DC500C806FE
/* MaterialCollectionViewLayout.swift in Sources */
,
96BCB7BF1CB40DC500C806FE
/* Color.swift in Sources */
,
96BCB7BF1CB40DC500C806FE
/* Color.swift in Sources */
,
96BCB7C61CB40DC500C806FE
/* Icon.swift in Sources */
,
96BCB7C61CB40DC500C806FE
/* Icon.swift in Sources */
,
...
@@ -963,7 +963,7 @@
...
@@ -963,7 +963,7 @@
96BCB7E11CB40DC500C806FE
/* BarView.swift in Sources */
,
96BCB7E11CB40DC500C806FE
/* BarView.swift in Sources */
,
96BCB7A11CB40DC500C806FE
/* BottomNavigationController.swift in Sources */
,
96BCB7A11CB40DC500C806FE
/* BottomNavigationController.swift in Sources */
,
96BCB7D81CB40DC500C806FE
/* MenuController.swift in Sources */
,
96BCB7D81CB40DC500C806FE
/* MenuController.swift in Sources */
,
96BCB7D41CB40DC500C806FE
/*
Material
TransitionAnimation.swift in Sources */
,
96BCB7D41CB40DC500C806FE
/* TransitionAnimation.swift in Sources */
,
967A48191D0F425A00B8CEB7
/* StatusBarController.swift in Sources */
,
967A48191D0F425A00B8CEB7
/* StatusBarController.swift in Sources */
,
96BCB7C21CB40DC500C806FE
/* Device.swift in Sources */
,
96BCB7C21CB40DC500C806FE
/* Device.swift in Sources */
,
96BCB7A41CB40DC500C806FE
/* CaptureSession.swift in Sources */
,
96BCB7A41CB40DC500C806FE
/* CaptureSession.swift in Sources */
,
...
@@ -982,7 +982,7 @@
...
@@ -982,7 +982,7 @@
966ECF2A1CF4C20100BB0BDF
/* MaterialCollectionReusableView.swift in Sources */
,
966ECF2A1CF4C20100BB0BDF
/* MaterialCollectionReusableView.swift in Sources */
,
96BCB7E51CB40DC500C806FE
/* TextField.swift in Sources */
,
96BCB7E51CB40DC500C806FE
/* TextField.swift in Sources */
,
96BCB7D21CB40DC500C806FE
/* MaterialTableViewCell.swift in Sources */
,
96BCB7D21CB40DC500C806FE
/* MaterialTableViewCell.swift in Sources */
,
96BCB7B61CB40DC500C806FE
/*
Material
Animation.swift in Sources */
,
96BCB7B61CB40DC500C806FE
/* Animation.swift in Sources */
,
96BCB7A71CB40DC500C806FE
/* ControlView.swift in Sources */
,
96BCB7A71CB40DC500C806FE
/* ControlView.swift in Sources */
,
96BCB7DB1CB40DC500C806FE
/* NavigationItem.swift in Sources */
,
96BCB7DB1CB40DC500C806FE
/* NavigationItem.swift in Sources */
,
96BCB7E01CB40DC500C806FE
/* NavigationDrawerController.swift in Sources */
,
96BCB7E01CB40DC500C806FE
/* NavigationDrawerController.swift in Sources */
,
...
@@ -998,8 +998,8 @@
...
@@ -998,8 +998,8 @@
96BCB7E41CB40DC500C806FE
/* Text.swift in Sources */
,
96BCB7E41CB40DC500C806FE
/* Text.swift in Sources */
,
96BCB7AB1CB40DC500C806FE
/* ImageCard.swift in Sources */
,
96BCB7AB1CB40DC500C806FE
/* ImageCard.swift in Sources */
,
96977DA61CBB2E49000BEFC4
/* Material+UIImage+FilterBlur.swift in Sources */
,
96977DA61CBB2E49000BEFC4
/* Material+UIImage+FilterBlur.swift in Sources */
,
96BCB7CB1CB40DC500C806FE
/*
Material
PulseAnimation.swift in Sources */
,
96BCB7CB1CB40DC500C806FE
/* PulseAnimation.swift in Sources */
,
96BCB7B71CB40DC500C806FE
/*
Material
BasicAnimation.swift in Sources */
,
96BCB7B71CB40DC500C806FE
/* BasicAnimation.swift in Sources */
,
96BCB7AE1CB40DC500C806FE
/* Material+UIFont.swift in Sources */
,
96BCB7AE1CB40DC500C806FE
/* Material+UIFont.swift in Sources */
,
96BCB7D91CB40DC500C806FE
/* NavigationBar.swift in Sources */
,
96BCB7D91CB40DC500C806FE
/* NavigationBar.swift in Sources */
,
);
);
...
...
Sources/OSX/Color.swift
View file @
e15b9fff
/*
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* * Neither the name of CosmicMind nor the names of its
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
*/
import
App
Kit
import
UI
Kit
public
struct
Color
{
public
struct
Color
{
// clear
// clear
public
static
let
clear
:
NSColor
=
NSColor
.
clearColo
r
()
public
static
let
clear
:
NSColor
=
NSColor
.
clea
r
()
// white
// white
public
static
let
white
:
NSColor
=
NSColor
.
whiteColor
()
public
static
let
white
:
NSColor
=
NSColor
.
white
()
// black
// black
public
static
let
black
:
NSColor
=
NSColor
.
blackColor
()
public
static
let
black
:
NSColor
=
NSColor
.
black
()
// dark text
// dark text
public
struct
darkText
{
public
struct
darkText
{
public
static
let
primary
:
NSColor
=
NSColor
.
blackColor
()
.
colorW
ithAlphaComponent
(
0.87
)
public
static
let
primary
:
NSColor
=
Color
.
black
.
w
ithAlphaComponent
(
0.87
)
public
static
let
secondary
:
NSColor
=
NSColor
.
blackColor
()
.
colorW
ithAlphaComponent
(
0.54
)
public
static
let
secondary
:
NSColor
=
Color
.
black
.
w
ithAlphaComponent
(
0.54
)
public
static
let
others
:
NSColor
=
NSColor
.
blackColor
()
.
colorW
ithAlphaComponent
(
0.38
)
public
static
let
others
:
NSColor
=
Color
.
black
.
w
ithAlphaComponent
(
0.38
)
public
static
let
dividers
:
NSColor
=
NSColor
.
blackColor
()
.
colorW
ithAlphaComponent
(
0.12
)
public
static
let
dividers
:
NSColor
=
Color
.
black
.
w
ithAlphaComponent
(
0.12
)
}
}
// light text
// light text
public
struct
lightText
{
public
struct
lightText
{
public
static
let
primary
:
NSColor
=
NSColor
.
whiteColor
()
public
static
let
primary
:
NSColor
=
Color
.
white
public
static
let
secondary
:
NSColor
=
NSColor
.
whiteColor
()
.
colorW
ithAlphaComponent
(
0.7
)
public
static
let
secondary
:
NSColor
=
Color
.
white
.
w
ithAlphaComponent
(
0.7
)
public
static
let
others
:
NSColor
=
NSColor
.
whiteColor
()
.
colorW
ithAlphaComponent
(
0.5
)
public
static
let
others
:
NSColor
=
Color
.
white
.
w
ithAlphaComponent
(
0.5
)
public
static
let
dividers
:
NSColor
=
NSColor
.
whiteColor
()
.
colorW
ithAlphaComponent
(
0.12
)
public
static
let
dividers
:
NSColor
=
Color
.
white
.
w
ithAlphaComponent
(
0.12
)
}
}
// red
// red
...
@@ -326,6 +326,7 @@ public struct Color {
...
@@ -326,6 +326,7 @@ public struct Color {
public
static
let
accent4
:
NSColor
=
NSColor
(
red
:
255
/
255
,
green
:
109
/
255
,
blue
:
0
/
255
,
alpha
:
1
)
public
static
let
accent4
:
NSColor
=
NSColor
(
red
:
255
/
255
,
green
:
109
/
255
,
blue
:
0
/
255
,
alpha
:
1
)
}
}
// deep orange
// deep orange
public
struct
deepOrange
{
public
struct
deepOrange
{
public
static
let
lighten5
:
NSColor
=
NSColor
(
red
:
251
/
255
,
green
:
233
/
255
,
blue
:
231
/
255
,
alpha
:
1
)
public
static
let
lighten5
:
NSColor
=
NSColor
(
red
:
251
/
255
,
green
:
233
/
255
,
blue
:
231
/
255
,
alpha
:
1
)
...
@@ -344,6 +345,7 @@ public struct Color {
...
@@ -344,6 +345,7 @@ public struct Color {
public
static
let
accent4
:
NSColor
=
NSColor
(
red
:
221
/
255
,
green
:
44
/
255
,
blue
:
0
/
255
,
alpha
:
1
)
public
static
let
accent4
:
NSColor
=
NSColor
(
red
:
221
/
255
,
green
:
44
/
255
,
blue
:
0
/
255
,
alpha
:
1
)
}
}
// brown
// brown
public
struct
brown
{
public
struct
brown
{
public
static
let
lighten5
:
NSColor
=
NSColor
(
red
:
239
/
255
,
green
:
235
/
255
,
blue
:
233
/
255
,
alpha
:
1
)
public
static
let
lighten5
:
NSColor
=
NSColor
(
red
:
239
/
255
,
green
:
235
/
255
,
blue
:
233
/
255
,
alpha
:
1
)
...
...
Sources/iOS/
MaterialKeyframeAnimation
.swift
→
Sources/iOS/
AnimateKeyframe
.swift
View file @
e15b9fff
...
@@ -30,18 +30,18 @@
...
@@ -30,18 +30,18 @@
import
UIKit
import
UIKit
public
typealias
MaterialAnimation
RotationModeType
=
String
public
typealias
Animate
RotationModeType
=
String
public
enum
MaterialAnimation
RotationMode
{
public
enum
Animate
RotationMode
{
case
None
case
None
case
Auto
case
Auto
case
AutoReverse
case
AutoReverse
}
}
/**
/**
:name:
MaterialAnimation
RotationModeToValue
:name:
Animate
RotationModeToValue
*/
*/
public
func
MaterialAnimationRotationModeToValue
(
mode
:
MaterialAnimationRotationMode
)
->
MaterialAnimation
RotationModeType
?
{
public
func
AnimateRotationModeToValue
(
mode
:
AnimateRotationMode
)
->
Animate
RotationModeType
?
{
switch
mode
{
switch
mode
{
case
.
none
:
case
.
none
:
return
nil
return
nil
...
@@ -52,15 +52,15 @@ public func MaterialAnimationRotationModeToValue(mode: MaterialAnimationRotation
...
@@ -52,15 +52,15 @@ public func MaterialAnimationRotationModeToValue(mode: MaterialAnimationRotation
}
}
}
}
public
extension
MaterialAnimation
{
public
extension
Animate
{
/**
/**
:name: path
:name: path
*/
*/
public
static
func
path
(
bezierPath
:
UIBezierPath
,
mode
:
MaterialAnimation
RotationMode
=
.
Auto
,
duration
:
CFTimeInterval
?
=
nil
)
->
CAKeyframeAnimation
{
public
static
func
path
(
bezierPath
:
UIBezierPath
,
mode
:
Animate
RotationMode
=
.
Auto
,
duration
:
CFTimeInterval
?
=
nil
)
->
CAKeyframeAnimation
{
let
animation
:
CAKeyframeAnimation
=
CAKeyframeAnimation
()
let
animation
:
CAKeyframeAnimation
=
CAKeyframeAnimation
()
animation
.
keyPath
=
"position"
animation
.
keyPath
=
"position"
animation
.
path
=
bezierPath
.
CGPath
animation
.
path
=
bezierPath
.
CGPath
animation
.
rotationMode
=
MaterialAnimation
RotationModeToValue
(
mode
)
animation
.
rotationMode
=
Animate
RotationModeToValue
(
mode
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
}
}
...
...
Sources/iOS/
Material
Animation.swift
→
Sources/iOS/Animation.swift
View file @
e15b9fff
...
@@ -30,52 +30,46 @@
...
@@ -30,52 +30,46 @@
import
UIKit
import
UIKit
@objc(MaterialAnimationDelegate)
public
typealias
AnimationFillModeType
=
String
public
protocol
MaterialAnimationDelegate
:
MaterialDelegate
{
optional
func
materialAnimationDidStart
(
animation
:
CAAnimation
)
optional
func
materialAnimationDidStop
(
animation
:
CAAnimation
,
finished
flag
:
Bool
)
}
public
typealias
MaterialAnimationFillModeType
=
String
public
enum
Material
AnimationFillMode
{
public
enum
AnimationFillMode
{
case
F
orwards
case
f
orwards
case
B
ackwards
case
b
ackwards
case
B
oth
case
b
oth
case
R
emoved
case
r
emoved
}
}
/**
/**
:name:
Material
AnimationFillModeToValue
:name: AnimationFillModeToValue
*/
*/
public
func
MaterialAnimationFillModeToValue
(
mode
:
MaterialAnimationFillMode
)
->
Material
AnimationFillModeType
{
public
func
AnimationFillModeToValue
(
mode
:
AnimationFillMode
)
->
AnimationFillModeType
{
switch
mode
{
switch
mode
{
case
.
F
orwards
:
case
.
f
orwards
:
return
kCAFillModeForwards
return
kCAFillModeForwards
case
.
B
ackwards
:
case
.
b
ackwards
:
return
kCAFillModeBackwards
return
kCAFillModeBackwards
case
.
B
oth
:
case
.
b
oth
:
return
kCAFillModeBoth
return
kCAFillModeBoth
case
.
R
emoved
:
case
.
r
emoved
:
return
kCAFillModeRemoved
return
kCAFillModeRemoved
}
}
}
}
public
typealias
Material
AnimationDelayCancelBlock
=
(
cancel
:
Bool
)
->
Void
public
typealias
AnimationDelayCancelBlock
=
(
cancel
:
Bool
)
->
Void
public
struct
Material
Animation
{
public
struct
Animation
{
/// Delay helper method.
/// Delay helper method.
public
static
func
delay
(
time
:
TimeInterval
,
completion
:
()
->
Void
)
->
Material
AnimationDelayCancelBlock
?
{
public
static
func
delay
(
time
:
TimeInterval
,
completion
:
()
->
Void
)
->
AnimationDelayCancelBlock
?
{
func
dispatch_later
(
completion
:
()
->
Void
)
{
func
dispatch_later
(
completion
:
()
->
Void
)
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
Int64
(
time
*
Double
(
NSEC_PER_SEC
))),
dispatch_get_main_queue
(),
completion
)
DispatchQueue
.
main
.
after
(
when
:
DispatchTime
.
now
()
+
time
,
execute
:
completion
)
}
}
var
cancelable
:
Material
AnimationDelayCancelBlock
?
var
cancelable
:
AnimationDelayCancelBlock
?
let
delayed
:
Material
AnimationDelayCancelBlock
=
{
(
cancel
:
Bool
)
in
let
delayed
:
AnimationDelayCancelBlock
=
{
(
cancel
:
Bool
)
in
if
!
cancel
{
if
!
cancel
{
dispatch_async
(
dispatch_get_main_queue
(),
completion
)
DispatchQueue
.
main
.
asynchronously
(
execute
:
completion
)
}
}
cancelable
=
nil
cancelable
=
nil
}
}
...
@@ -92,7 +86,7 @@ public struct MaterialAnimation {
...
@@ -92,7 +86,7 @@ public struct MaterialAnimation {
/**
/**
:name: delayCancel
:name: delayCancel
*/
*/
public
static
func
delayCancel
(
completion
:
Material
AnimationDelayCancelBlock
?)
{
public
static
func
delayCancel
(
completion
:
AnimationDelayCancelBlock
?)
{
completion
?(
cancel
:
true
)
completion
?(
cancel
:
true
)
}
}
...
@@ -101,7 +95,7 @@ public struct MaterialAnimation {
...
@@ -101,7 +95,7 @@ public struct MaterialAnimation {
:name: animationDisabled
:name: animationDisabled
*/
*/
public
static
func
animationDisabled
(
animations
:
(()
->
Void
))
{
public
static
func
animationDisabled
(
animations
:
(()
->
Void
))
{
animateWithDuration
(
0
,
animations
:
animations
)
animateWithDuration
(
duration
:
0
,
animations
:
animations
)
}
}
/**
/**
...
@@ -119,10 +113,10 @@ public struct MaterialAnimation {
...
@@ -119,10 +113,10 @@ public struct MaterialAnimation {
/**
/**
:name: animationGroup
:name: animationGroup
*/
*/
public
static
func
animationGroup
(
animations
:
Array
<
CAAnimation
>
,
duration
:
CFTimeInterval
=
0.5
)
->
CAAnimationGroup
{
public
static
func
animationGroup
(
animations
:
[
CAAnimation
]
,
duration
:
CFTimeInterval
=
0.5
)
->
CAAnimationGroup
{
let
group
:
CAAnimationGroup
=
CAAnimationGroup
()
let
group
:
CAAnimationGroup
=
CAAnimationGroup
()
group
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
group
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
group
.
r
emovedOnCompletion
=
false
group
.
isR
emovedOnCompletion
=
false
group
.
animations
=
animations
group
.
animations
=
animations
group
.
duration
=
duration
group
.
duration
=
duration
group
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
group
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
...
@@ -133,8 +127,8 @@ public struct MaterialAnimation {
...
@@ -133,8 +127,8 @@ public struct MaterialAnimation {
:name: animateWithDelay
:name: animateWithDelay
*/
*/
public
static
func
animateWithDelay
(
delay
d
:
CFTimeInterval
,
duration
:
CFTimeInterval
,
animations
:
(()
->
Void
),
completion
:
(()
->
Void
)?
=
nil
)
{
public
static
func
animateWithDelay
(
delay
d
:
CFTimeInterval
,
duration
:
CFTimeInterval
,
animations
:
(()
->
Void
),
completion
:
(()
->
Void
)?
=
nil
)
{
delay
(
d
)
{
delay
(
time
:
d
)
{
animateWithDuration
(
duration
,
animations
:
animations
,
completion
:
completion
)
animateWithDuration
(
duration
:
duration
,
animations
:
animations
,
completion
:
completion
)
}
}
}
}
}
}
Sources/iOS/
Material
BasicAnimation.swift
→
Sources/iOS/BasicAnimation.swift
View file @
e15b9fff
...
@@ -30,14 +30,14 @@
...
@@ -30,14 +30,14 @@
import
UIKit
import
UIKit
public
extension
Material
Animation
{
public
extension
Animation
{
/**
/**
:name: backgroundColor
:name: backgroundColor
*/
*/
public
static
func
backgroundColor
(
color
:
UIColor
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
backgroundColor
(
color
:
UIColor
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"backgroundColor"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"backgroundColor"
)
animation
.
toValue
=
color
.
cgColor
animation
.
toValue
=
color
.
cgColor
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
mode
:
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
isRemovedOnCompletion
=
false
animation
.
isRemovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
...
@@ -52,7 +52,7 @@ public extension MaterialAnimation {
...
@@ -52,7 +52,7 @@ public extension MaterialAnimation {
public
static
func
cornerRadius
(
radius
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
cornerRadius
(
radius
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"cornerRadius"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"cornerRadius"
)
animation
.
toValue
=
radius
animation
.
toValue
=
radius
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
isRemovedOnCompletion
=
false
animation
.
isRemovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
...
@@ -66,8 +66,8 @@ public extension MaterialAnimation {
...
@@ -66,8 +66,8 @@ public extension MaterialAnimation {
*/
*/
public
static
func
transform
(
transform
:
CATransform3D
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
transform
(
transform
:
CATransform3D
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform"
)
animation
.
toValue
=
NSValue
(
CA
Transform3D
:
transform
)
animation
.
toValue
=
NSValue
(
ca
Transform3D
:
transform
)
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
isRemovedOnCompletion
=
false
animation
.
isRemovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
...
@@ -79,15 +79,15 @@ public extension MaterialAnimation {
...
@@ -79,15 +79,15 @@ public extension MaterialAnimation {
/**
/**
:name: rotate
:name: rotate
*/
*/
public
static
func
rotate
(
angle
angle
:
CGFloat
?
=
nil
,
rotation
:
CGFloat
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
rotate
(
angle
:
CGFloat
?
=
nil
,
rotation
:
CGFloat
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.rotation"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.rotation"
)
if
let
v
:
CGFloat
=
angle
{
if
let
v
:
CGFloat
=
angle
{
animation
.
toValue
=
(
CGFloat
(
M_PI
)
*
v
/
180
)
as
NSNumber
animation
.
toValue
=
(
CGFloat
(
M_PI
)
*
v
/
180
)
as
NSNumber
}
else
if
let
v
:
CGFloat
=
rotation
{
}
else
if
let
v
:
CGFloat
=
rotation
{
animation
.
toValue
=
(
CGFloat
(
M_PI
*
2
)
*
v
)
as
NSNumber
animation
.
toValue
=
(
CGFloat
(
M_PI
*
2
)
*
v
)
as
NSNumber
}
}
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -98,15 +98,15 @@ public extension MaterialAnimation {
...
@@ -98,15 +98,15 @@ public extension MaterialAnimation {
/**
/**
:name: rotateX
:name: rotateX
*/
*/
public
static
func
rotateX
(
angle
angle
:
CGFloat
?
=
nil
,
rotation
:
CGFloat
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
rotateX
(
angle
:
CGFloat
?
=
nil
,
rotation
:
CGFloat
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.rotation.x"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.rotation.x"
)
if
let
v
:
CGFloat
=
angle
{
if
let
v
:
CGFloat
=
angle
{
animation
.
toValue
=
(
CGFloat
(
M_PI
)
*
v
/
180
)
as
NSNumber
animation
.
toValue
=
(
CGFloat
(
M_PI
)
*
v
/
180
)
as
NSNumber
}
else
if
let
v
:
CGFloat
=
rotation
{
}
else
if
let
v
:
CGFloat
=
rotation
{
animation
.
toValue
=
(
CGFloat
(
M_PI
*
2
)
*
v
)
as
NSNumber
animation
.
toValue
=
(
CGFloat
(
M_PI
*
2
)
*
v
)
as
NSNumber
}
}
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -117,15 +117,15 @@ public extension MaterialAnimation {
...
@@ -117,15 +117,15 @@ public extension MaterialAnimation {
/**
/**
:name: rotateY
:name: rotateY
*/
*/
public
static
func
rotateY
(
angle
angle
:
CGFloat
?
=
nil
,
rotation
:
CGFloat
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
rotateY
(
angle
:
CGFloat
?
=
nil
,
rotation
:
CGFloat
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.rotation.y"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.rotation.y"
)
if
let
v
:
CGFloat
=
angle
{
if
let
v
:
CGFloat
=
angle
{
animation
.
toValue
=
(
CGFloat
(
M_PI
)
*
v
/
180
)
as
NSNumber
animation
.
toValue
=
(
CGFloat
(
M_PI
)
*
v
/
180
)
as
NSNumber
}
else
if
let
v
:
CGFloat
=
rotation
{
}
else
if
let
v
:
CGFloat
=
rotation
{
animation
.
toValue
=
(
CGFloat
(
M_PI
*
2
)
*
v
)
as
NSNumber
animation
.
toValue
=
(
CGFloat
(
M_PI
*
2
)
*
v
)
as
NSNumber
}
}
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -136,15 +136,15 @@ public extension MaterialAnimation {
...
@@ -136,15 +136,15 @@ public extension MaterialAnimation {
/**
/**
:name: rotateZ
:name: rotateZ
*/
*/
public
static
func
rotateZ
(
angle
angle
:
CGFloat
?
=
nil
,
rotation
:
CGFloat
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
rotateZ
(
angle
:
CGFloat
?
=
nil
,
rotation
:
CGFloat
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.rotation.z"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.rotation.z"
)
if
let
v
:
CGFloat
=
angle
{
if
let
v
:
CGFloat
=
angle
{
animation
.
toValue
=
(
CGFloat
(
M_PI
)
*
v
/
180
)
as
NSNumber
animation
.
toValue
=
(
CGFloat
(
M_PI
)
*
v
/
180
)
as
NSNumber
}
else
if
let
v
:
CGFloat
=
rotation
{
}
else
if
let
v
:
CGFloat
=
rotation
{
animation
.
toValue
=
(
CGFloat
(
M_PI
*
2
)
*
v
)
as
NSNumber
animation
.
toValue
=
(
CGFloat
(
M_PI
*
2
)
*
v
)
as
NSNumber
}
}
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -158,8 +158,8 @@ public extension MaterialAnimation {
...
@@ -158,8 +158,8 @@ public extension MaterialAnimation {
public
static
func
scale
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
scale
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.scale"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.scale"
)
animation
.
toValue
=
scale
as
NSNumber
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -173,8 +173,8 @@ public extension MaterialAnimation {
...
@@ -173,8 +173,8 @@ public extension MaterialAnimation {
public
static
func
scaleX
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
scaleX
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.scale.x"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.scale.x"
)
animation
.
toValue
=
scale
as
NSNumber
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -188,8 +188,8 @@ public extension MaterialAnimation {
...
@@ -188,8 +188,8 @@ public extension MaterialAnimation {
public
static
func
scaleY
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
scaleY
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.scale.y"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.scale.y"
)
animation
.
toValue
=
scale
as
NSNumber
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -203,8 +203,8 @@ public extension MaterialAnimation {
...
@@ -203,8 +203,8 @@ public extension MaterialAnimation {
public
static
func
scaleZ
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
scaleZ
(
scale
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.scale.z"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.scale.z"
)
animation
.
toValue
=
scale
as
NSNumber
animation
.
toValue
=
scale
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -217,9 +217,9 @@ public extension MaterialAnimation {
...
@@ -217,9 +217,9 @@ public extension MaterialAnimation {
*/
*/
public
static
func
translate
(
translation
:
CGSize
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
translate
(
translation
:
CGSize
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.translation"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.translation"
)
animation
.
toValue
=
NSValue
(
CG
Size
:
translation
)
animation
.
toValue
=
NSValue
(
cg
Size
:
translation
)
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -233,8 +233,8 @@ public extension MaterialAnimation {
...
@@ -233,8 +233,8 @@ public extension MaterialAnimation {
public
static
func
translateX
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
translateX
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.translation.x"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.translation.x"
)
animation
.
toValue
=
translation
as
NSNumber
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -248,8 +248,8 @@ public extension MaterialAnimation {
...
@@ -248,8 +248,8 @@ public extension MaterialAnimation {
public
static
func
translateY
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
translateY
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.translation.y"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.translation.y"
)
animation
.
toValue
=
translation
as
NSNumber
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -263,8 +263,8 @@ public extension MaterialAnimation {
...
@@ -263,8 +263,8 @@ public extension MaterialAnimation {
public
static
func
translateZ
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
translateZ
(
translation
:
CGFloat
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.translation.z"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"transform.translation.z"
)
animation
.
toValue
=
translation
as
NSNumber
animation
.
toValue
=
translation
as
NSNumber
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -277,9 +277,9 @@ public extension MaterialAnimation {
...
@@ -277,9 +277,9 @@ public extension MaterialAnimation {
*/
*/
public
static
func
position
(
point
:
CGPoint
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
position
(
point
:
CGPoint
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"position"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"position"
)
animation
.
toValue
=
NSValue
(
CG
Point
:
point
)
animation
.
toValue
=
NSValue
(
cg
Point
:
point
)
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
@@ -290,8 +290,8 @@ public extension MaterialAnimation {
...
@@ -290,8 +290,8 @@ public extension MaterialAnimation {
public
static
func
shadowPath
(
path
:
CGPath
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
public
static
func
shadowPath
(
path
:
CGPath
,
duration
:
CFTimeInterval
?
=
nil
)
->
CABasicAnimation
{
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"shadowPath"
)
let
animation
:
CABasicAnimation
=
CABasicAnimation
(
keyPath
:
"shadowPath"
)
animation
.
toValue
=
path
animation
.
toValue
=
path
animation
.
fillMode
=
MaterialAnimationFillModeToValue
(
.
F
orwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
f
orwards
)
animation
.
r
emovedOnCompletion
=
false
animation
.
isR
emovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunctionEaseInEaseOut
)
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
...
Sources/iOS/Button.swift
View file @
e15b9fff
...
@@ -217,12 +217,12 @@ public class Button: UIButton {
...
@@ -217,12 +217,12 @@ public class Button: UIButton {
*/
*/
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Material
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Material
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
}
}
}
}
...
@@ -234,7 +234,7 @@ public class Button: UIButton {
...
@@ -234,7 +234,7 @@ public class Button: UIButton {
*/
*/
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -245,7 +245,7 @@ public class Button: UIButton {
...
@@ -245,7 +245,7 @@ public class Button: UIButton {
*/
*/
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -256,7 +256,7 @@ public class Button: UIButton {
...
@@ -256,7 +256,7 @@ public class Button: UIButton {
*/
*/
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -303,7 +303,7 @@ public class Button: UIButton {
...
@@ -303,7 +303,7 @@ public class Button: UIButton {
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
}
else
{
}
else
{
animate
(
animation
:
Material
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
animate
(
animation
:
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
}
}
}
}
}
}
...
...
Sources/iOS/Capture.swift
View file @
e15b9fff
...
@@ -210,7 +210,7 @@ public class Capture : View, UIGestureRecognizerDelegate {
...
@@ -210,7 +210,7 @@ public class Capture : View, UIGestureRecognizerDelegate {
}
}
/// Content insert value.
/// Content insert value.
public
var
contentInset
:
Inset
=
EdgeInsetsPresetToValue
(
preset
:
.
square4
)
{
public
var
contentInset
:
EdgeInsets
=
EdgeInsetsPresetToValue
(
preset
:
.
square4
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -544,17 +544,26 @@ public class Capture : View, UIGestureRecognizerDelegate {
...
@@ -544,17 +544,26 @@ public class Capture : View, UIGestureRecognizerDelegate {
}
}
/// Animates the tap and layer.
/// Animates the tap and layer.
private
func
animateTapLayer
(
layer
v
:
Layer
,
point
:
CGPoint
)
{
private
func
animateTapLayer
(
layer
:
Layer
,
point
:
CGPoint
)
{
MaterialAnimation
.
animationDisabled
{
Animation
.
animationDisabled
{
[
weak
layer
]
in
guard
let
v
=
layer
else
{
return
}
v
.
transform
=
CATransform3DIdentity
v
.
transform
=
CATransform3DIdentity
v
.
position
=
point
v
.
position
=
point
v
.
isHidden
=
false
v
.
isHidden
=
false
}
}
MaterialAnimation
.
animateWithDuration
(
duration
:
0.25
,
animations
:
{
Animation
.
animateWithDuration
(
duration
:
0.25
,
animations
:
{
[
weak
layer
]
in
guard
let
v
=
layer
else
{
return
}
v
.
transform
=
CATransform3DMakeScale
(
0.5
,
0.5
,
1
)
v
.
transform
=
CATransform3DMakeScale
(
0.5
,
0.5
,
1
)
})
{
})
{
MaterialAnimation
.
delay
(
0.4
)
{
Animation
.
delay
(
time
:
0.4
)
{
[
weak
layer
]
in
MaterialAnimation
.
animationDisabled
{
Animation
.
animationDisabled
{
[
weak
layer
]
in
guard
let
v
=
layer
else
{
return
}
v
.
isHidden
=
true
v
.
isHidden
=
true
}
}
}
}
...
...
Sources/iOS/Card.swift
View file @
e15b9fff
...
@@ -393,7 +393,7 @@ public class Card: PulseView {
...
@@ -393,7 +393,7 @@ public class Card: PulseView {
super
.
prepareView
()
super
.
prepareView
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
dividerColor
=
Color
.
grey
.
lighten3
dividerColor
=
Color
.
grey
.
lighten3
cornerRadiusPreset
=
.
Radius1
cornerRadiusPreset
=
.
corner
Radius1
}
}
/**
/**
...
...
Sources/iOS/Color.swift
View file @
e15b9fff
...
@@ -32,28 +32,28 @@ import UIKit
...
@@ -32,28 +32,28 @@ import UIKit
public
struct
Color
{
public
struct
Color
{
// clear
// clear
public
static
let
clear
:
UIColor
=
UIColor
.
clear
Color
()
public
static
let
clear
:
UIColor
=
UIColor
.
clear
()
// white
// white
public
static
let
white
:
UIColor
=
UIColor
.
white
Color
()
public
static
let
white
:
UIColor
=
UIColor
.
white
()
// black
// black
public
static
let
black
:
UIColor
=
UIColor
.
black
Color
()
public
static
let
black
:
UIColor
=
UIColor
.
black
()
// dark text
// dark text
public
struct
darkText
{
public
struct
darkText
{
public
static
let
primary
:
UIColor
=
Color
.
black
.
colorW
ithAlphaComponent
(
0.87
)
public
static
let
primary
:
UIColor
=
Color
.
black
.
w
ithAlphaComponent
(
0.87
)
public
static
let
secondary
:
UIColor
=
Color
.
black
.
colorW
ithAlphaComponent
(
0.54
)
public
static
let
secondary
:
UIColor
=
Color
.
black
.
w
ithAlphaComponent
(
0.54
)
public
static
let
others
:
UIColor
=
Color
.
black
.
colorW
ithAlphaComponent
(
0.38
)
public
static
let
others
:
UIColor
=
Color
.
black
.
w
ithAlphaComponent
(
0.38
)
public
static
let
dividers
:
UIColor
=
Color
.
black
.
colorW
ithAlphaComponent
(
0.12
)
public
static
let
dividers
:
UIColor
=
Color
.
black
.
w
ithAlphaComponent
(
0.12
)
}
}
// light text
// light text
public
struct
lightText
{
public
struct
lightText
{
public
static
let
primary
:
UIColor
=
Color
.
white
public
static
let
primary
:
UIColor
=
Color
.
white
public
static
let
secondary
:
UIColor
=
Color
.
white
.
colorW
ithAlphaComponent
(
0.7
)
public
static
let
secondary
:
UIColor
=
Color
.
white
.
w
ithAlphaComponent
(
0.7
)
public
static
let
others
:
UIColor
=
Color
.
white
.
colorW
ithAlphaComponent
(
0.5
)
public
static
let
others
:
UIColor
=
Color
.
white
.
w
ithAlphaComponent
(
0.5
)
public
static
let
dividers
:
UIColor
=
Color
.
white
.
colorW
ithAlphaComponent
(
0.12
)
public
static
let
dividers
:
UIColor
=
Color
.
white
.
w
ithAlphaComponent
(
0.12
)
}
}
// red
// red
...
...
Sources/iOS/FabButton.swift
View file @
e15b9fff
...
@@ -41,8 +41,8 @@ public class FabButton: Button {
...
@@ -41,8 +41,8 @@ public class FabButton: Button {
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
shape
=
.
circle
shape
Preset
=
.
circle
pulseAnimation
=
.
C
enterWithBacking
pulseAnimation
=
.
c
enterWithBacking
pulseColor
=
Color
.
white
pulseColor
=
Color
.
white
tintColor
=
Color
.
white
tintColor
=
Color
.
white
backgroundColor
=
Color
.
red
.
base
backgroundColor
=
Color
.
red
.
base
...
...
Sources/iOS/FlatButton.swift
View file @
e15b9fff
...
@@ -40,7 +40,7 @@ public class FlatButton: Button {
...
@@ -40,7 +40,7 @@ public class FlatButton: Button {
*/
*/
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
cornerRadiusPreset
=
.
Radius1
cornerRadiusPreset
=
.
corner
Radius1
contentEdgeInsetsPreset
=
.
wideRectangle3
contentEdgeInsetsPreset
=
.
wideRectangle3
}
}
}
}
Sources/iOS/IconButton.swift
View file @
e15b9fff
...
@@ -40,7 +40,7 @@ public class IconButton: Button {
...
@@ -40,7 +40,7 @@ public class IconButton: Button {
*/
*/
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
cornerRadiusPreset
=
.
Radius1
cornerRadiusPreset
=
.
corner
Radius1
pulseAnimation
=
.
center
pulseAnimation
=
.
center
}
}
}
}
Sources/iOS/ImageCard.swift
View file @
e15b9fff
...
@@ -534,7 +534,7 @@ public class ImageCard: PulseView {
...
@@ -534,7 +534,7 @@ public class ImageCard: PulseView {
super
.
prepareView
()
super
.
prepareView
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
dividerColor
=
Color
.
grey
.
lighten3
dividerColor
=
Color
.
grey
.
lighten3
cornerRadiusPreset
=
.
Radius1
cornerRadiusPreset
=
.
corner
Radius1
}
}
/**
/**
...
...
Sources/iOS/KeyframeAnimation.swift
0 → 100644
View file @
e15b9fff
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
public
enum
AnimationRotationMode
{
case
none
case
auto
case
autoReverse
}
/**
:name: AnimationRotationModeToValue
*/
public
func
AnimationRotationModeToValue
(
mode
:
AnimationRotationMode
)
->
String
?
{
switch
mode
{
case
.
none
:
return
nil
case
.
auto
:
return
kCAAnimationRotateAuto
case
.
autoReverse
:
return
kCAAnimationRotateAutoReverse
}
}
public
extension
Animation
{
/**
:name: path
*/
public
static
func
path
(
bezierPath
:
UIBezierPath
,
mode
:
AnimationRotationMode
=
.
auto
,
duration
:
CFTimeInterval
?
=
nil
)
->
CAKeyframeAnimation
{
let
animation
:
CAKeyframeAnimation
=
CAKeyframeAnimation
()
animation
.
keyPath
=
"position"
animation
.
path
=
bezierPath
.
cgPath
animation
.
rotationMode
=
AnimationRotationModeToValue
(
mode
:
mode
)
if
let
v
=
duration
{
animation
.
duration
=
v
}
return
animation
}
}
Sources/iOS/Layer.swift
View file @
e15b9fff
...
@@ -309,7 +309,7 @@ public class Layer: CAShapeLayer {
...
@@ -309,7 +309,7 @@ public class Layer: CAShapeLayer {
- Parameter animation: The currently running CAAnimation instance.
- Parameter animation: The currently running CAAnimation instance.
*/
*/
public
override
func
animationDidStart
(
_
animation
:
CAAnimation
)
{
public
override
func
animationDidStart
(
_
animation
:
CAAnimation
)
{
(
delegate
as?
Material
AnimationDelegate
)?
.
materialAnimationDidStart
?(
animation
:
animation
)
(
delegate
as?
AnimationDelegate
)?
.
materialAnimationDidStart
?(
animation
:
animation
)
}
}
/**
/**
...
@@ -330,7 +330,7 @@ public class Layer: CAShapeLayer {
...
@@ -330,7 +330,7 @@ public class Layer: CAShapeLayer {
}
}
}
}
}
}
(
delegate
as?
Material
AnimationDelegate
)?
.
materialAnimationDidStop
?(
animation
:
animation
,
finished
:
flag
)
(
delegate
as?
AnimationDelegate
)?
.
materialAnimationDidStop
?(
animation
:
animation
,
finished
:
flag
)
}
else
if
let
a
:
CAAnimationGroup
=
animation
as?
CAAnimationGroup
{
}
else
if
let
a
:
CAAnimationGroup
=
animation
as?
CAAnimationGroup
{
for
x
in
a
.
animations
!
{
for
x
in
a
.
animations
!
{
animationDidStop
(
x
,
finished
:
true
)
animationDidStop
(
x
,
finished
:
true
)
...
@@ -370,7 +370,7 @@ public class Layer: CAShapeLayer {
...
@@ -370,7 +370,7 @@ public class Layer: CAShapeLayer {
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
}
else
{
}
else
{
animate
(
animation
:
Material
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
animate
(
animation
:
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
}
}
}
}
}
}
...
...
Sources/iOS/MaterialCollectionReusableView.swift
View file @
e15b9fff
...
@@ -118,7 +118,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -118,7 +118,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
/// A Preset for the contentsGravity property.
/// A Preset for the contentsGravity property.
public
var
contentsGravityPreset
:
MaterialGravity
{
public
var
contentsGravityPreset
:
MaterialGravity
{
didSet
{
didSet
{
contentsGravity
=
MaterialGravityToValue
(
contentsGravityPreset
)
contentsGravity
=
MaterialGravityToValue
(
gravity
:
contentsGravityPreset
)
}
}
}
}
...
@@ -133,7 +133,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -133,7 +133,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
}
}
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
public
var
contentEdgeInsetsPreset
:
Insets
{
public
var
contentEdgeInsetsPreset
:
EdgeInsetsPreset
{
get
{
get
{
return
grid
.
contentEdgeInsetsPreset
return
grid
.
contentEdgeInsetsPreset
}
}
...
@@ -153,9 +153,9 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -153,9 +153,9 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
public
var
interimSpacePreset
:
InterimSpace
=
.
none
{
public
var
interimSpacePreset
:
InterimSpace
Preset
=
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
}
}
...
@@ -208,7 +208,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -208,7 +208,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
if
.
none
!=
shape
{
if
.
none
!=
shape
Preset
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
}
}
}
}
...
@@ -226,7 +226,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -226,7 +226,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
if
.
none
!=
shape
{
if
.
none
!=
shape
Preset
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
}
}
}
}
...
@@ -310,12 +310,12 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -310,12 +310,12 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
*/
*/
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Material
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Material
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
}
}
}
}
...
@@ -327,7 +327,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -327,7 +327,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
*/
*/
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -338,7 +338,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -338,7 +338,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
*/
*/
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -349,7 +349,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -349,7 +349,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
*/
*/
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -396,7 +396,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -396,7 +396,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
}
else
{
}
else
{
animate
(
animation
:
Material
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
animate
(
animation
:
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
}
}
}
}
}
}
...
...
Sources/iOS/MaterialCollectionView.swift
View file @
e15b9fff
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
import
UIKit
import
UIKit
@IBDesignable
@IBDesignable
public
class
MaterialCollectionView
:
UICollectionView
{
public
class
MaterialCollectionView
:
UICollectionView
{
/// A property that accesses the layer.frame.origin.x property.
/// A property that accesses the layer.frame.origin.x property.
@IBInspectable
public
var
x
:
CGFloat
{
@IBInspectable
public
var
x
:
CGFloat
{
get
{
get
{
...
@@ -73,12 +73,12 @@ public class MaterialCollectionView : UICollectionView {
...
@@ -73,12 +73,12 @@ public class MaterialCollectionView : UICollectionView {
}
}
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
public
var
contentEdgeInsetsPreset
:
Insets
{
public
var
contentEdgeInsetsPreset
:
Edge
Insets
{
get
{
get
{
return
(
collectionViewLayout
as?
MaterialCollectionViewLayout
)
!.
content
EdgeInsetsPre
set
return
(
collectionViewLayout
as?
MaterialCollectionViewLayout
)
!.
content
In
set
}
}
set
(
value
)
{
set
(
value
)
{
(
collectionViewLayout
as?
MaterialCollectionViewLayout
)
!.
content
EdgeInsetsPre
set
=
value
(
collectionViewLayout
as?
MaterialCollectionViewLayout
)
!.
content
In
set
=
value
}
}
}
}
...
@@ -102,9 +102,9 @@ public class MaterialCollectionView : UICollectionView {
...
@@ -102,9 +102,9 @@ public class MaterialCollectionView : UICollectionView {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
public
var
interimSpacePreset
:
InterimSpace
=
.
none
{
public
var
interimSpacePreset
:
InterimSpace
Preset
=
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
}
}
...
...
Sources/iOS/MaterialCollectionViewCell.swift
View file @
e15b9fff
...
@@ -118,7 +118,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
...
@@ -118,7 +118,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
/// A Preset for the contentsGravity property.
/// A Preset for the contentsGravity property.
public
var
contentsGravityPreset
:
MaterialGravity
{
public
var
contentsGravityPreset
:
MaterialGravity
{
didSet
{
didSet
{
contentsGravity
=
MaterialGravityToValue
(
contentsGravityPreset
)
contentsGravity
=
MaterialGravityToValue
(
gravity
:
contentsGravityPreset
)
}
}
}
}
...
@@ -153,9 +153,9 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
...
@@ -153,9 +153,9 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
public
var
interimSpacePreset
:
InterimSpace
=
.
none
{
public
var
interimSpacePreset
:
InterimSpace
Preset
=
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
}
}
...
@@ -290,8 +290,8 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
...
@@ -290,8 +290,8 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
CGRect
.
zero
)
}
}
public
override
func
layoutSublayers
OfLayer
(
layer
:
CALayer
)
{
public
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
OfLayer
(
layer
)
super
.
layoutSublayers
(
of
:
layer
)
if
self
.
layer
==
layer
{
if
self
.
layer
==
layer
{
layoutShape
()
layoutShape
()
layoutVisualLayer
()
layoutVisualLayer
()
...
@@ -310,12 +310,12 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
...
@@ -310,12 +310,12 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
*/
*/
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Material
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Material
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
}
}
}
}
...
@@ -327,7 +327,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
...
@@ -327,7 +327,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
*/
*/
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -338,7 +338,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
...
@@ -338,7 +338,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
*/
*/
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -349,7 +349,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
...
@@ -349,7 +349,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
*/
*/
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -390,12 +390,12 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
...
@@ -390,12 +390,12 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
/// Sets the shadow path.
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
if
shadowPathAutoSizeEnabled
{
if
.
none
==
depth
{
if
.
none
==
depth
Preset
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CG
Path
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cg
Path
}
else
{
}
else
{
animate
(
MaterialAnimation
.
shadowPath
(
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CG
Path
,
duration
:
0
))
animate
(
animation
:
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cg
Path
,
duration
:
0
))
}
}
}
}
}
}
...
...
Sources/iOS/MaterialCollectionViewDataSource.swift
View file @
e15b9fff
...
@@ -30,10 +30,10 @@
...
@@ -30,10 +30,10 @@
import
UIKit
import
UIKit
public
protocol
MaterialCollectionViewDataSource
:
UICollectionViewDataSource
{
public
protocol
MaterialCollectionViewDataSource
:
UICollectionViewDataSource
{
/**
/**
Retrieves the items for the collectionView.
Retrieves the items for the collectionView.
- Returns: An Array of Arrays of MaterialDataSourceItem objects.
- Returns: An Array of Arrays of MaterialDataSourceItem objects.
*/
*/
func
items
()
->
Array
<
MaterialDataSourceItem
>
func
items
()
->
[
MaterialDataSourceItem
]
}
}
Sources/iOS/MaterialCollectionViewDelegate.swift
View file @
e15b9fff
...
@@ -30,6 +30,6 @@
...
@@ -30,6 +30,6 @@
import
UIKit
import
UIKit
public
protocol
MaterialCollectionViewDelegate
:
MaterialDelegate
,
UICollectionViewDelegate
{
public
protocol
MaterialCollectionViewDelegate
:
MaterialDelegate
,
UICollectionViewDelegate
{
}
}
Sources/iOS/MaterialCollectionViewLayout.swift
View file @
e15b9fff
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
import
UIKit
import
UIKit
public
class
MaterialCollectionViewLayout
:
UICollectionViewLayout
{
public
class
MaterialCollectionViewLayout
:
UICollectionViewLayout
{
/// Used to calculate the dimensions of the cells.
/// Used to calculate the dimensions of the cells.
internal
var
offset
:
CGPoint
=
CGPoint
.
zero
internal
var
offset
:
CGPoint
=
CGPoint
.
zero
...
...
Sources/iOS/MaterialTableViewCell.swift
View file @
e15b9fff
...
@@ -165,12 +165,12 @@ public class MaterialTableViewCell: UITableViewCell {
...
@@ -165,12 +165,12 @@ public class MaterialTableViewCell: UITableViewCell {
*/
*/
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Material
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Material
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
}
}
}
}
...
@@ -182,7 +182,7 @@ public class MaterialTableViewCell: UITableViewCell {
...
@@ -182,7 +182,7 @@ public class MaterialTableViewCell: UITableViewCell {
*/
*/
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -193,7 +193,7 @@ public class MaterialTableViewCell: UITableViewCell {
...
@@ -193,7 +193,7 @@ public class MaterialTableViewCell: UITableViewCell {
*/
*/
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -204,7 +204,7 @@ public class MaterialTableViewCell: UITableViewCell {
...
@@ -204,7 +204,7 @@ public class MaterialTableViewCell: UITableViewCell {
*/
*/
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -243,9 +243,9 @@ public class MaterialTableViewCell: UITableViewCell {
...
@@ -243,9 +243,9 @@ public class MaterialTableViewCell: UITableViewCell {
if
.
none
==
depth
{
if
.
none
==
depth
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CG
Path
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cg
Path
}
else
{
}
else
{
animate
(
MaterialAnimation
.
shadowPath
(
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CG
Path
,
duration
:
0
))
animate
(
Animation
.
shadowPath
(
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cg
Path
,
duration
:
0
))
}
}
}
}
}
}
...
...
Sources/iOS/
Material
PulseAnimation.swift
→
Sources/iOS/PulseAnimation.swift
View file @
e15b9fff
...
@@ -40,7 +40,7 @@ public enum PulseAnimation {
...
@@ -40,7 +40,7 @@ public enum PulseAnimation {
case
pointWithBacking
case
pointWithBacking
}
}
internal
extension
Material
Animation
{
internal
extension
Animation
{
/**
/**
Triggers the expanding animation.
Triggers the expanding animation.
- Parameter layer: Container CALayer.
- Parameter layer: Container CALayer.
...
@@ -66,7 +66,7 @@ internal extension MaterialAnimation {
...
@@ -66,7 +66,7 @@ internal extension MaterialAnimation {
pulseLayers
.
insert
(
bLayer
,
at
:
0
)
pulseLayers
.
insert
(
bLayer
,
at
:
0
)
visualLayer
.
addSublayer
(
bLayer
)
visualLayer
.
addSublayer
(
bLayer
)
Material
Animation
.
animationDisabled
(
animations
:
{
Animation
.
animationDisabled
(
animations
:
{
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
)
...
@@ -88,19 +88,19 @@ internal extension MaterialAnimation {
...
@@ -88,19 +88,19 @@ internal extension MaterialAnimation {
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
:
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
:
bLayer
.
add
(
Material
Animation
.
backgroundColor
(
color
:
pulseColor
.
withAlphaComponent
(
pulseOpacity
/
2
),
duration
:
duration
),
forKey
:
nil
)
bLayer
.
add
(
Animation
.
backgroundColor
(
color
:
pulseColor
.
withAlphaComponent
(
pulseOpacity
/
2
),
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
point
,
.
pointWithBacking
:
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
point
,
.
pointWithBacking
:
pLayer
.
add
(
Material
Animation
.
scale
(
scale
:
1
,
duration
:
duration
),
forKey
:
nil
)
pLayer
.
add
(
Animation
.
scale
(
scale
:
1
,
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
MaterialAnimation
.
delay
(
time
:
duration
,
completion
:
{
Animation
.
delay
(
time
:
duration
)
{
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
}
)
}
}
}
/**
/**
...
@@ -114,31 +114,35 @@ internal extension MaterialAnimation {
...
@@ -114,31 +114,35 @@ internal extension MaterialAnimation {
return
return
}
}
let
animated
:
Bool
?
=
bLayer
.
value
(
forKey
:
"animated"
)
as?
Bool
guard
let
animated
=
bLayer
.
value
(
forKey
:
"animated"
)
as?
Bool
else
{
return
}
Animation
.
delay
(
time
:
animated
?
0
:
0.15
)
{
guard
let
pLayer
:
CAShapeLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
else
{
return
}
MaterialAnimation
.
delay
(
time
:
true
==
animated
?
0
:
0.15
)
{
let
duration
=
0.325
if
let
pLayer
:
CAShapeLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
{
let
duration
:
CFTimeInterval
=
0.325
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
:
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
:
bLayer
.
add
(
MaterialAnimation
.
backgroundColor
(
color
:
pulseColor
.
withAlphaComponent
(
0
),
duration
:
0.325
),
forKey
:
nil
)
bLayer
.
add
(
Animation
.
backgroundColor
(
color
:
pulseColor
.
withAlphaComponent
(
0
),
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
point
,
.
pointWithBacking
:
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
point
,
.
pointWithBacking
:
pLayer
.
addAnimation
(
Material
Animation
.
animationGroup
(
animations
:
[
pLayer
.
add
(
Animation
.
animationGroup
(
animations
:
[
MaterialAnimation
.
scale
(
scale
:
.
C
enter
==
pulseAnimation
?
1
:
1.325
),
Animation
.
scale
(
scale
:
.
c
enter
==
pulseAnimation
?
1
:
1.325
),
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorW
ithAlphaComponent
(
0
))
Animation
.
backgroundColor
(
color
:
pulseColor
.
w
ithAlphaComponent
(
0
))
],
duration
:
duration
),
forKey
:
nil
)
],
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
MaterialAnimation
.
delay
(
time
:
duration
,
completion
:
{
Animation
.
delay
(
time
:
duration
)
{
pLayer
.
removeFromSuperlayer
()
pLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
})
}
}
}
}
}
}
...
...
Sources/iOS/PulseView.swift
View file @
e15b9fff
...
@@ -54,12 +54,12 @@ public class PulseView: View {
...
@@ -54,12 +54,12 @@ public class PulseView: View {
*/
*/
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Material
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
Animation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
Material
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
}
}
}
}
...
@@ -71,7 +71,7 @@ public class PulseView: View {
...
@@ -71,7 +71,7 @@ public class PulseView: View {
*/
*/
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
Material
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -82,7 +82,7 @@ public class PulseView: View {
...
@@ -82,7 +82,7 @@ public class PulseView: View {
*/
*/
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -93,6 +93,6 @@ public class PulseView: View {
...
@@ -93,6 +93,6 @@ public class PulseView: View {
*/
*/
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
Material
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
Animation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
}
}
Sources/iOS/RaisedButton.swift
View file @
e15b9fff
...
@@ -41,7 +41,7 @@ public class RaisedButton: Button {
...
@@ -41,7 +41,7 @@ public class RaisedButton: Button {
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
cornerRadiusPreset
=
.
Radius1
cornerRadiusPreset
=
.
corner
Radius1
contentEdgeInsetsPreset
=
.
wideRectangle3
contentEdgeInsetsPreset
=
.
wideRectangle3
backgroundColor
=
Color
.
white
backgroundColor
=
Color
.
white
}
}
...
...
Sources/iOS/TextView.swift
View file @
e15b9fff
...
@@ -247,9 +247,9 @@ public class TextView: UITextView {
...
@@ -247,9 +247,9 @@ public class TextView: UITextView {
if
.
none
==
depth
{
if
.
none
==
depth
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CG
Path
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cg
Path
}
else
{
}
else
{
animate
(
MaterialAnimation
.
shadowPath
(
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CG
Path
,
duration
:
0
))
animate
(
Animation
.
shadowPath
(
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cg
Path
,
duration
:
0
))
}
}
}
}
}
}
...
...
Sources/iOS/
Material
TransitionAnimation.swift
→
Sources/iOS/TransitionAnimation.swift
View file @
e15b9fff
...
@@ -30,17 +30,17 @@
...
@@ -30,17 +30,17 @@
import
UIKit
import
UIKit
public
typealias
Material
AnimationTransitionType
=
String
public
typealias
AnimationTransitionType
=
String
public
typealias
Material
AnimationTransitionSubTypeType
=
String
public
typealias
AnimationTransitionSubTypeType
=
String
public
enum
Material
AnimationTransition
{
public
enum
AnimationTransition
{
case
Fade
case
Fade
case
MoveIn
case
MoveIn
case
Push
case
Push
case
Reveal
case
Reveal
}
}
public
enum
Material
AnimationTransitionSubType
{
public
enum
AnimationTransitionSubType
{
case
Right
case
Right
case
Left
case
Left
case
Top
case
Top
...
@@ -48,9 +48,9 @@ public enum MaterialAnimationTransitionSubType {
...
@@ -48,9 +48,9 @@ public enum MaterialAnimationTransitionSubType {
}
}
/**
/**
:name:
Material
AnimationTransitionToValue
:name: AnimationTransitionToValue
*/
*/
public
func
MaterialAnimationTransitionToValue
(
transition
:
MaterialAnimationTransition
)
->
Material
AnimationTransitionType
{
public
func
AnimationTransitionToValue
(
transition
:
AnimationTransition
)
->
AnimationTransitionType
{
switch
transition
{
switch
transition
{
case
.
Fade
:
case
.
Fade
:
return
kCATransitionFade
return
kCATransitionFade
...
@@ -64,9 +64,9 @@ public func MaterialAnimationTransitionToValue(transition: MaterialAnimationTran
...
@@ -64,9 +64,9 @@ public func MaterialAnimationTransitionToValue(transition: MaterialAnimationTran
}
}
/**
/**
:name:
Material
AnimationTransitionSubTypeToValue
:name: AnimationTransitionSubTypeToValue
*/
*/
public
func
MaterialAnimationTransitionSubTypeToValue
(
direction
:
MaterialAnimationTransitionSubType
)
->
Material
AnimationTransitionSubTypeType
{
public
func
AnimationTransitionSubTypeToValue
(
direction
:
AnimationTransitionSubType
)
->
AnimationTransitionSubTypeType
{
switch
direction
{
switch
direction
{
case
.
Right
:
case
.
Right
:
return
kCATransitionFromRight
return
kCATransitionFromRight
...
@@ -79,15 +79,15 @@ public func MaterialAnimationTransitionSubTypeToValue(direction: MaterialAnimati
...
@@ -79,15 +79,15 @@ public func MaterialAnimationTransitionSubTypeToValue(direction: MaterialAnimati
}
}
}
}
public
extension
Material
Animation
{
public
extension
Animation
{
/**
/**
:name: transition
:name: transition
*/
*/
public
static
func
transition
(
type
:
MaterialAnimationTransition
,
direction
:
Material
AnimationTransitionSubType
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CATransition
{
public
static
func
transition
(
type
:
AnimationTransition
,
direction
:
AnimationTransitionSubType
?
=
nil
,
duration
:
CFTimeInterval
?
=
nil
)
->
CATransition
{
let
animation
:
CATransition
=
CATransition
()
let
animation
:
CATransition
=
CATransition
()
animation
.
type
=
MaterialAnimationTransitionToValue
(
type
)
animation
.
type
=
AnimationTransitionToValue
(
transition
:
type
)
if
let
d
=
direction
{
if
let
d
=
direction
{
animation
.
subtype
=
MaterialAnimationTransitionSubTypeToValue
(
d
)
animation
.
subtype
=
AnimationTransitionSubTypeToValue
(
direction
:
d
)
}
}
if
let
v
:
CFTimeInterval
=
duration
{
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
...
Sources/iOS/View.swift
View file @
e15b9fff
...
@@ -302,7 +302,7 @@ public class View: UIView {
...
@@ -302,7 +302,7 @@ public class View: UIView {
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
}
else
{
}
else
{
animate
(
animation
:
Material
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
animate
(
animation
:
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
}
}
}
}
}
}
...
...
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