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
9875036d
Unverified
Commit
9875036d
authored
Dec 25, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: rename to Motion classes, where adding Motion as a suffix rather than a prefix
parent
63d8d3af
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
78 additions
and
77 deletions
+78
-77
Material.xcodeproj/project.pbxproj
+0
-0
Sources/iOS/BasicMotion.swift
+0
-0
Sources/iOS/Button.swift
+6
-6
Sources/iOS/CollectionReusableView.swift
+6
-6
Sources/iOS/CollectionViewCell.swift
+6
-6
Sources/iOS/FABMenu.swift
+4
-4
Sources/iOS/KeyframeMotion.swift
+2
-1
Sources/iOS/Menu.swift
+4
-4
Sources/iOS/PulseMotion.swift
+11
-11
Sources/iOS/PulseView.swift
+6
-6
Sources/iOS/SpringMotion.swift
+12
-12
Sources/iOS/TableViewCell.swift
+6
-6
Sources/iOS/TransitionMotion.swift
+15
-15
No files found.
Material.xcodeproj/project.pbxproj
View file @
9875036d
This diff is collapsed.
Click to expand it.
Sources/iOS/
MotionBasic
.swift
→
Sources/iOS/
BasicMotion
.swift
View file @
9875036d
File moved
Sources/iOS/Button.swift
View file @
9875036d
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
import
UIKit
import
UIKit
open
class
Button
:
UIButton
,
MotionPulseable
{
open
class
Button
:
UIButton
,
PulseableMotion
{
/**
/**
A CAShapeLayer used to manage elements that would be affected by
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
the clipToBounds property of the backing layer. For example, this
...
@@ -40,10 +40,10 @@ open class Button: UIButton, MotionPulseable {
...
@@ -40,10 +40,10 @@ open class Button: UIButton, MotionPulseable {
open
let
visualLayer
=
CAShapeLayer
()
open
let
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
/// A Pulse reference.
fileprivate
var
pulse
:
MotionPulse
!
fileprivate
var
pulse
:
PulseMotion
!
///
MotionPulse
Animation value.
///
PulseMotion
Animation value.
open
var
pulseAnimation
:
MotionPulse
Animation
{
open
var
pulseAnimation
:
PulseMotion
Animation
{
get
{
get
{
return
pulse
.
animation
return
pulse
.
animation
}
}
...
@@ -52,7 +52,7 @@ open class Button: UIButton, MotionPulseable {
...
@@ -52,7 +52,7 @@ open class Button: UIButton, MotionPulseable {
}
}
}
}
///
MotionPulse
Animation color.
///
PulseMotion
Animation color.
@IBInspectable
@IBInspectable
open
var
pulseColor
:
UIColor
{
open
var
pulseColor
:
UIColor
{
get
{
get
{
...
@@ -261,7 +261,7 @@ extension Button {
...
@@ -261,7 +261,7 @@ extension Button {
/// Prepares the pulse motion.
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
fileprivate
func
preparePulse
()
{
pulse
=
MotionPulse
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
pulse
=
PulseMotion
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
}
}
/**
/**
...
...
Sources/iOS/CollectionReusableView.swift
View file @
9875036d
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
import
UIKit
import
UIKit
@objc(CollectionReusableView)
@objc(CollectionReusableView)
open
class
CollectionReusableView
:
UICollectionReusableView
,
MotionPulseable
{
open
class
CollectionReusableView
:
UICollectionReusableView
,
PulseableMotion
{
/**
/**
A CAShapeLayer used to manage elements that would be affected by
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
the clipToBounds property of the backing layer. For example, this
...
@@ -41,10 +41,10 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
...
@@ -41,10 +41,10 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
open
let
visualLayer
=
CAShapeLayer
()
open
let
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
/// A Pulse reference.
fileprivate
var
pulse
:
MotionPulse
!
fileprivate
var
pulse
:
PulseMotion
!
///
MotionPulse
Animation value.
///
PulseMotion
Animation value.
open
var
pulseAnimation
:
MotionPulse
Animation
{
open
var
pulseAnimation
:
PulseMotion
Animation
{
get
{
get
{
return
pulse
.
animation
return
pulse
.
animation
}
}
...
@@ -53,7 +53,7 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
...
@@ -53,7 +53,7 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
}
}
}
}
///
MotionPulse
Animation color.
///
PulseMotion
Animation color.
@IBInspectable
@IBInspectable
open
var
pulseColor
:
UIColor
{
open
var
pulseColor
:
UIColor
{
get
{
get
{
...
@@ -295,7 +295,7 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
...
@@ -295,7 +295,7 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
extension
CollectionReusableView
{
extension
CollectionReusableView
{
/// Prepares the pulse motion.
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
fileprivate
func
preparePulse
()
{
pulse
=
MotionPulse
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
pulse
=
PulseMotion
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
pulseAnimation
=
.
none
pulseAnimation
=
.
none
}
}
...
...
Sources/iOS/CollectionViewCell.swift
View file @
9875036d
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
import
UIKit
import
UIKit
@objc(CollectionViewCell)
@objc(CollectionViewCell)
open
class
CollectionViewCell
:
UICollectionViewCell
,
MotionPulseable
{
open
class
CollectionViewCell
:
UICollectionViewCell
,
PulseableMotion
{
/**
/**
A CAShapeLayer used to manage elements that would be affected by
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
the clipToBounds property of the backing layer. For example, this
...
@@ -41,10 +41,10 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
...
@@ -41,10 +41,10 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
open
let
visualLayer
=
CAShapeLayer
()
open
let
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
/// A Pulse reference.
fileprivate
var
pulse
:
MotionPulse
!
fileprivate
var
pulse
:
PulseMotion
!
///
MotionPulse
Animation value.
///
PulseMotion
Animation value.
open
var
pulseAnimation
:
MotionPulse
Animation
{
open
var
pulseAnimation
:
PulseMotion
Animation
{
get
{
get
{
return
pulse
.
animation
return
pulse
.
animation
}
}
...
@@ -53,7 +53,7 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
...
@@ -53,7 +53,7 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
}
}
}
}
///
MotionPulse
Animation color.
///
PulseMotion
Animation color.
@IBInspectable
@IBInspectable
open
var
pulseColor
:
UIColor
{
open
var
pulseColor
:
UIColor
{
get
{
get
{
...
@@ -256,7 +256,7 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
...
@@ -256,7 +256,7 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
extension
CollectionViewCell
{
extension
CollectionViewCell
{
/// Prepares the pulse motion.
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
fileprivate
func
preparePulse
()
{
pulse
=
MotionPulse
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
pulse
=
PulseMotion
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
}
}
/// Prepares the visualLayer property.
/// Prepares the visualLayer property.
...
...
Sources/iOS/FABMenu.swift
View file @
9875036d
...
@@ -53,12 +53,12 @@ public protocol FABMenuDelegate {
...
@@ -53,12 +53,12 @@ public protocol FABMenuDelegate {
@objc(FABMenu)
@objc(FABMenu)
open
class
FABMenu
:
View
,
MotionSpringable
{
open
class
FABMenu
:
View
,
SpringableMotion
{
/// A reference to the
MotionSpring
object.
/// A reference to the
SpringMotion
object.
internal
let
spring
=
MotionSpring
()
internal
let
spring
=
SpringMotion
()
/// The direction in which the animation opens the menu.
/// The direction in which the animation opens the menu.
open
var
springDirection
=
MotionSpring
Direction
.
up
{
open
var
springDirection
=
SpringMotion
Direction
.
up
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
...
...
Sources/iOS/
MotionKeyframe
.swift
→
Sources/iOS/
KeyframeMotion
.swift
View file @
9875036d
...
@@ -66,7 +66,8 @@ extension Motion {
...
@@ -66,7 +66,8 @@ extension Motion {
animation
.
keyPath
=
AnimationKeyPath
.
position
.
rawValue
animation
.
keyPath
=
AnimationKeyPath
.
position
.
rawValue
animation
.
path
=
bezierPath
.
cgPath
animation
.
path
=
bezierPath
.
cgPath
animation
.
rotationMode
=
AnimationRotationModeToValue
(
mode
:
mode
)
animation
.
rotationMode
=
AnimationRotationModeToValue
(
mode
:
mode
)
if
let
v
=
duration
{
if
let
v
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
}
}
return
animation
return
animation
...
...
Sources/iOS/Menu.swift
View file @
9875036d
...
@@ -53,15 +53,15 @@ public protocol MenuDelegate {
...
@@ -53,15 +53,15 @@ public protocol MenuDelegate {
@objc(Menu)
@objc(Menu)
open
class
Menu
:
View
,
MotionSpringable
{
open
class
Menu
:
View
,
SpringableMotion
{
/// A reference to the
MotionSpring
object.
/// A reference to the
SpringMotion
object.
internal
let
spring
=
MotionSpring
()
internal
let
spring
=
SpringMotion
()
/// An optional delegation handler.
/// An optional delegation handler.
open
weak
var
delegate
:
MenuDelegate
?
open
weak
var
delegate
:
MenuDelegate
?
/// The direction in which the animation opens the menu.
/// The direction in which the animation opens the menu.
open
var
springDirection
=
MotionSpring
Direction
.
up
{
open
var
springDirection
=
SpringMotion
Direction
.
up
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
...
...
Sources/iOS/
MotionPulse
.swift
→
Sources/iOS/
PulseMotion
.swift
View file @
9875036d
...
@@ -30,8 +30,8 @@
...
@@ -30,8 +30,8 @@
import
UIKit
import
UIKit
@objc(
MotionPulse
Animation)
@objc(
PulseMotion
Animation)
public
enum
MotionPulse
Animation
:
Int
{
public
enum
PulseMotion
Animation
:
Int
{
case
none
case
none
case
center
case
center
case
centerWithBacking
case
centerWithBacking
...
@@ -42,9 +42,9 @@ public enum MotionPulseAnimation: Int {
...
@@ -42,9 +42,9 @@ public enum MotionPulseAnimation: Int {
case
pointWithBacking
case
pointWithBacking
}
}
public
protocol
MotionPulseable
{
public
protocol
PulseableMotion
{
/// A reference to the
MotionPulse
Animation.
/// A reference to the
PulseMotion
Animation.
var
pulseAnimation
:
MotionPulse
Animation
{
get
set
}
var
pulseAnimation
:
PulseMotion
Animation
{
get
set
}
/// A UIColor.
/// A UIColor.
var
pulseColor
:
UIColor
{
get
set
}
var
pulseColor
:
UIColor
{
get
set
}
...
@@ -53,8 +53,8 @@ public protocol MotionPulseable {
...
@@ -53,8 +53,8 @@ public protocol MotionPulseable {
var
pulseOpacity
:
CGFloat
{
get
set
}
var
pulseOpacity
:
CGFloat
{
get
set
}
}
}
public
struct
MotionPulse
{
public
struct
PulseMotion
{
/// A UIView that is
MotionPulseable
.
/// A UIView that is
PulseableMotion
.
fileprivate
weak
var
pulseView
:
UIView
?
fileprivate
weak
var
pulseView
:
UIView
?
/// The layer the pulse layers are added to.
/// The layer the pulse layers are added to.
...
@@ -63,8 +63,8 @@ public struct MotionPulse {
...
@@ -63,8 +63,8 @@ public struct MotionPulse {
/// Pulse layers.
/// Pulse layers.
fileprivate
var
layers
=
[
CAShapeLayer
]()
fileprivate
var
layers
=
[
CAShapeLayer
]()
/// A reference to the
MotionPulse
Animation.
/// A reference to the
PulseMotion
Animation.
public
var
animation
=
MotionPulse
Animation
.
pointWithBacking
public
var
animation
=
PulseMotion
Animation
.
pointWithBacking
/// A UIColor.
/// A UIColor.
public
var
color
=
Color
.
grey
.
base
public
var
color
=
Color
.
grey
.
base
...
@@ -83,7 +83,7 @@ public struct MotionPulse {
...
@@ -83,7 +83,7 @@ public struct MotionPulse {
}
}
}
}
extension
MotionPulse
{
extension
PulseMotion
{
/**
/**
Triggers the expanding animation.
Triggers the expanding animation.
- Parameter point: A point to pulse from.
- Parameter point: A point to pulse from.
...
@@ -161,7 +161,7 @@ extension MotionPulse {
...
@@ -161,7 +161,7 @@ extension MotionPulse {
}
}
}
}
extension
MotionPulse
{
extension
PulseMotion
{
/// Triggers the contracting animation.
/// Triggers the contracting animation.
public
mutating
func
contract
()
{
public
mutating
func
contract
()
{
guard
let
bLayer
=
layers
.
popLast
()
else
{
guard
let
bLayer
=
layers
.
popLast
()
else
{
...
...
Sources/iOS/PulseView.swift
View file @
9875036d
...
@@ -30,12 +30,12 @@
...
@@ -30,12 +30,12 @@
import
UIKit
import
UIKit
open
class
PulseView
:
View
,
MotionPulseable
{
open
class
PulseView
:
View
,
PulseableMotion
{
/// A Pulse reference.
/// A Pulse reference.
fileprivate
var
pulse
:
MotionPulse
!
fileprivate
var
pulse
:
PulseMotion
!
///
MotionPulse
Animation value.
///
PulseMotion
Animation value.
open
var
pulseAnimation
:
MotionPulse
Animation
{
open
var
pulseAnimation
:
PulseMotion
Animation
{
get
{
get
{
return
pulse
.
animation
return
pulse
.
animation
}
}
...
@@ -44,7 +44,7 @@ open class PulseView: View, MotionPulseable {
...
@@ -44,7 +44,7 @@ open class PulseView: View, MotionPulseable {
}
}
}
}
///
MotionPulse
Animation color.
///
PulseMotion
Animation color.
@IBInspectable
@IBInspectable
open
var
pulseColor
:
UIColor
{
open
var
pulseColor
:
UIColor
{
get
{
get
{
...
@@ -129,6 +129,6 @@ open class PulseView: View, MotionPulseable {
...
@@ -129,6 +129,6 @@ open class PulseView: View, MotionPulseable {
extension
PulseView
{
extension
PulseView
{
/// Prepares the pulse motion.
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
fileprivate
func
preparePulse
()
{
pulse
=
MotionPulse
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
pulse
=
PulseMotion
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
}
}
}
}
Sources/iOS/
MotionSpring
.swift
→
Sources/iOS/
SpringMotion
.swift
View file @
9875036d
...
@@ -30,22 +30,22 @@
...
@@ -30,22 +30,22 @@
import
UIKit
import
UIKit
@objc(
MotionSpring
Direction)
@objc(
SpringMotion
Direction)
public
enum
MotionSpring
Direction
:
Int
{
public
enum
SpringMotion
Direction
:
Int
{
case
up
case
up
case
down
case
down
case
left
case
left
case
right
case
right
}
}
public
protocol
MotionSpringable
{
public
protocol
SpringableMotion
{
/// A
MotionSpring
Direction value.
/// A
SpringMotion
Direction value.
var
springDirection
:
MotionSpring
Direction
{
get
set
}
var
springDirection
:
SpringMotion
Direction
{
get
set
}
}
}
open
class
MotionSpring
{
open
class
SpringMotion
{
/// A
MotionSpring
Direction value.
/// A
SpringMotion
Direction value.
open
var
direction
=
MotionSpring
Direction
.
up
open
var
direction
=
SpringMotion
Direction
.
up
/// A Boolean that indicates if the menu is open or not.
/// A Boolean that indicates if the menu is open or not.
open
var
isOpened
=
false
open
var
isOpened
=
false
...
@@ -111,7 +111,7 @@ open class MotionSpring {
...
@@ -111,7 +111,7 @@ open class MotionSpring {
}
}
}
}
extension
MotionSpring
{
extension
SpringMotion
{
/// Disable the Menu if views exist.
/// Disable the Menu if views exist.
fileprivate
func
disable
()
{
fileprivate
func
disable
()
{
guard
0
<
views
.
count
else
{
guard
0
<
views
.
count
else
{
...
@@ -134,7 +134,7 @@ extension MotionSpring {
...
@@ -134,7 +134,7 @@ extension MotionSpring {
}
}
}
}
extension
MotionSpring
{
extension
SpringMotion
{
/**
/**
Expands the Spring component with animation options.
Expands the Spring component with animation options.
- Parameter duration: The time for each view's animation.
- Parameter duration: The time for each view's animation.
...
@@ -194,7 +194,7 @@ extension MotionSpring {
...
@@ -194,7 +194,7 @@ extension MotionSpring {
}
}
}
}
extension
MotionSpring
{
extension
SpringMotion
{
/**
/**
Handles the animation open completion.
Handles the animation open completion.
- Parameter view: A UIView.
- Parameter view: A UIView.
...
@@ -227,7 +227,7 @@ extension MotionSpring {
...
@@ -227,7 +227,7 @@ extension MotionSpring {
}
}
}
}
extension
MotionSpring
{
extension
SpringMotion
{
/**
/**
Open the Menu component with animation options in the Up direction.
Open the Menu component with animation options in the Up direction.
- Parameter duration: The time for each view's animation.
- Parameter duration: The time for each view's animation.
...
...
Sources/iOS/TableViewCell.swift
View file @
9875036d
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
import
UIKit
import
UIKit
open
class
TableViewCell
:
UITableViewCell
,
MotionPulseable
{
open
class
TableViewCell
:
UITableViewCell
,
PulseableMotion
{
/**
/**
A CAShapeLayer used to manage elements that would be affected by
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
the clipToBounds property of the backing layer. For example, this
...
@@ -40,10 +40,10 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
...
@@ -40,10 +40,10 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
open
let
visualLayer
=
CAShapeLayer
()
open
let
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
/// A Pulse reference.
fileprivate
var
pulse
:
MotionPulse
!
fileprivate
var
pulse
:
PulseMotion
!
///
MotionPulse
Animation value.
///
PulseMotion
Animation value.
open
var
pulseAnimation
:
MotionPulse
Animation
{
open
var
pulseAnimation
:
PulseMotion
Animation
{
get
{
get
{
return
pulse
.
animation
return
pulse
.
animation
}
}
...
@@ -52,7 +52,7 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
...
@@ -52,7 +52,7 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
}
}
}
}
///
MotionPulse
Animation color.
///
PulseMotion
Animation color.
@IBInspectable
@IBInspectable
open
var
pulseColor
:
UIColor
{
open
var
pulseColor
:
UIColor
{
get
{
get
{
...
@@ -177,7 +177,7 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
...
@@ -177,7 +177,7 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
extension
TableViewCell
{
extension
TableViewCell
{
/// Prepares the pulse motion.
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
fileprivate
func
preparePulse
()
{
pulse
=
MotionPulse
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
pulse
=
PulseMotion
(
pulseView
:
self
,
pulseLayer
:
visualLayer
)
}
}
/// Prepares the visualLayer property.
/// Prepares the visualLayer property.
...
...
Sources/iOS/
MotionTransi
tion.swift
→
Sources/iOS/
TransitionMo
tion.swift
View file @
9875036d
...
@@ -30,16 +30,16 @@
...
@@ -30,16 +30,16 @@
import
UIKit
import
UIKit
@objc(
AnimationTransi
tion)
@objc(
TransitionMo
tion)
public
enum
AnimationTransi
tion
:
Int
{
public
enum
TransitionMo
tion
:
Int
{
case
fade
case
fade
case
moveIn
case
moveIn
case
push
case
push
case
reveal
case
reveal
}
}
@objc(
AnimationTransi
tionDirection)
@objc(
TransitionMo
tionDirection)
public
enum
AnimationTransi
tionDirection
:
Int
{
public
enum
TransitionMo
tionDirection
:
Int
{
case
`
default
`
case
`
default
`
case
right
case
right
case
left
case
left
...
@@ -48,11 +48,11 @@ public enum AnimationTransitionDirection: Int {
...
@@ -48,11 +48,11 @@ public enum AnimationTransitionDirection: Int {
}
}
/**
/**
Converts an
AnimationTransi
tion to a corresponding CATransition key.
Converts an
TransitionMo
tion to a corresponding CATransition key.
- Parameter transition: An
AnimationTransi
tion.
- Parameter transition: An
TransitionMo
tion.
- Returns: A CATransition key String.
- Returns: A CATransition key String.
*/
*/
public
func
AnimationTransitionToValue
(
transition
type
:
AnimationTransi
tion
)
->
String
{
public
func
TransitionMotionToValue
(
transition
type
:
TransitionMo
tion
)
->
String
{
switch
type
{
switch
type
{
case
.
fade
:
case
.
fade
:
return
kCATransitionFade
return
kCATransitionFade
...
@@ -66,11 +66,11 @@ public func AnimationTransitionToValue(transition type: AnimationTransition) ->
...
@@ -66,11 +66,11 @@ public func AnimationTransitionToValue(transition type: AnimationTransition) ->
}
}
/**
/**
Converts an
AnimationTransi
tionDirection to a corresponding CATransition direction key.
Converts an
TransitionMo
tionDirection to a corresponding CATransition direction key.
- Parameter direction: An
AnimationTransi
tionDirection.
- Parameter direction: An
TransitionMo
tionDirection.
- Returns: An optional CATransition direction key String.
- Returns: An optional CATransition direction key String.
*/
*/
public
func
AnimationTransitionDirectionToValue
(
direction
:
AnimationTransi
tionDirection
)
->
String
?
{
public
func
TransitionMotionDirectionToValue
(
direction
:
TransitionMo
tionDirection
)
->
String
?
{
switch
direction
{
switch
direction
{
case
.
default
:
case
.
default
:
return
nil
return
nil
...
@@ -88,15 +88,15 @@ public func AnimationTransitionDirectionToValue(direction: AnimationTransitionDi
...
@@ -88,15 +88,15 @@ public func AnimationTransitionDirectionToValue(direction: AnimationTransitionDi
extension
Motion
{
extension
Motion
{
/**
/**
Creates a CATransition animation.
Creates a CATransition animation.
- Parameter type: An
AnimationTransi
tion.
- Parameter type: An
TransitionMo
tion.
- Parameter direction: An optional
AnimationTransi
tionDirection.
- Parameter direction: An optional
TransitionMo
tionDirection.
- Parameter duration: An optional duration time.
- Parameter duration: An optional duration time.
- Returns: A CATransition.
- Returns: A CATransition.
*/
*/
public
static
func
transition
(
type
:
AnimationTransition
,
direction
:
AnimationTransi
tionDirection
=
.
default
,
duration
:
CFTimeInterval
?
=
nil
)
->
CATransition
{
public
static
func
transition
(
type
:
TransitionMotion
,
direction
:
TransitionMo
tionDirection
=
.
default
,
duration
:
CFTimeInterval
?
=
nil
)
->
CATransition
{
let
animation
=
CATransition
()
let
animation
=
CATransition
()
animation
.
type
=
AnimationTransi
tionToValue
(
transition
:
type
)
animation
.
type
=
TransitionMo
tionToValue
(
transition
:
type
)
animation
.
subtype
=
AnimationTransi
tionDirectionToValue
(
direction
:
direction
)
animation
.
subtype
=
TransitionMo
tionDirectionToValue
(
direction
:
direction
)
if
let
v
=
duration
{
if
let
v
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
...
...
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