Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Motion
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
Motion
Commits
a26c532b
Unverified
Commit
a26c532b
authored
Jul 13, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated public motion helper properties to internal
parent
4a1008d8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
79 deletions
+78
-79
Sources/Extensions/Motion+UIView.swift
+55
-54
Sources/MotionAnimation.swift
+23
-25
No files found.
Sources/Extensions/Motion+UIView.swift
View file @
a26c532b
...
...
@@ -84,6 +84,61 @@ public extension UIView {
}
}
/**
A function that accepts CAAnimation objects and executes them on the
view's backing layer.
- Parameter animations: A list of CAAnimations.
*/
func
animate
(
_
animations
:
CAAnimation
...
)
{
layer
.
animate
(
animations
)
}
/**
A function that accepts an Array of CAAnimation objects and executes
them on the view's backing layer.
- Parameter animations: An Array of CAAnimations.
*/
func
animate
(
_
animations
:
[
CAAnimation
])
{
layer
.
animate
(
animations
)
}
/**
A function that accepts a list of MotionAnimation values and executes
them on the view's backing layer.
- Parameter animations: A list of MotionAnimation values.
*/
func
animate
(
_
animations
:
MotionAnimation
...
)
{
layer
.
animate
(
animations
)
}
/**
A function that accepts an Array of MotionAnimation values and executes
them on the view's backing layer.
- Parameter animations: An Array of MotionAnimation values.
- Parameter completion: An optional completion block.
*/
func
animate
(
_
animations
:
[
MotionAnimation
],
completion
:
(()
->
Void
)?
=
nil
)
{
layer
.
animate
(
animations
,
completion
:
completion
)
}
/**
A function that accepts a list of MotionTransition values.
- Parameter transitions: A list of MotionTransition values.
*/
func
transition
(
_
transitions
:
MotionTransition
...
)
{
transition
(
transitions
)
}
/**
A function that accepts an Array of MotionTransition values.
- Parameter transitions: An Array of MotionTransition values.
*/
func
transition
(
_
transitions
:
[
MotionTransition
])
{
motionTransitions
=
transitions
}
}
internal
extension
UIView
{
/// The animations to run while in transition.
var
motionTransitions
:
[
MotionTransition
]?
{
get
{
...
...
@@ -95,7 +150,6 @@ public extension UIView {
}
/// The animations to run while in transition.
@IBInspectable
var
motionAlpha
:
CGFloat
?
{
get
{
return
associatedInstance
.
alpha
...
...
@@ -139,59 +193,6 @@ public extension UIView {
var
motionScaleY
:
CGFloat
{
return
transform
.
b
}
/**
A function that accepts CAAnimation objects and executes them on the
view's backing layer.
- Parameter animations: A list of CAAnimations.
*/
func
animate
(
_
animations
:
CAAnimation
...
)
{
layer
.
animate
(
animations
)
}
/**
A function that accepts an Array of CAAnimation objects and executes
them on the view's backing layer.
- Parameter animations: An Array of CAAnimations.
*/
func
animate
(
_
animations
:
[
CAAnimation
])
{
layer
.
animate
(
animations
)
}
/**
A function that accepts a list of MotionAnimation values and executes
them on the view's backing layer.
- Parameter animations: A list of MotionAnimation values.
*/
func
animate
(
_
animations
:
MotionAnimation
...
)
{
layer
.
animate
(
animations
)
}
/**
A function that accepts an Array of MotionAnimation values and executes
them on the view's backing layer.
- Parameter animations: An Array of MotionAnimation values.
- Parameter completion: An optional completion block.
*/
func
animate
(
_
animations
:
[
MotionAnimation
],
completion
:
(()
->
Void
)?
=
nil
)
{
layer
.
animate
(
animations
,
completion
:
completion
)
}
/**
A function that accepts a list of MotionTransition values.
- Parameter transitions: A list of MotionTransition values.
*/
func
transition
(
_
transitions
:
MotionTransition
...
)
{
transition
(
transitions
)
}
/**
A function that accepts an Array of MotionTransition values.
- Parameter transitions: An Array of MotionTransition values.
*/
func
transition
(
_
transitions
:
[
MotionTransition
])
{
motionTransitions
=
transitions
}
}
internal
extension
UIView
{
...
...
Sources/MotionAnimation.swift
View file @
a26c532b
...
...
@@ -103,7 +103,7 @@ public extension MotionAnimation {
}
/**
Animates a view's current rotat
e
to the given x, y,
Animates a view's current rotat
ion
to the given x, y,
and z values.
- Parameter x: A CGFloat.
- Parameter y: A CGFloat.
...
...
@@ -120,9 +120,9 @@ public extension MotionAnimation {
}
/**
Animates a view's current rotat
e
to the given point.
Animates a view's current rotat
ion
to the given point.
- Parameter _ point: A CGPoint.
- Parameter z: A CGFloat
, default is 0
.
- Parameter z: A CGFloat.
- Returns: A MotionAnimation.
*/
static
func
rotate
(
_
point
:
CGPoint
,
z
:
CGFloat
=
0
)
->
MotionAnimation
{
...
...
@@ -155,7 +155,7 @@ public extension MotionAnimation {
/**
Animates a view's current spin to the given point.
- Parameter _ point: A CGPoint.
- Parameter z: A CGFloat
, default is 0
.
- Parameter z: A CGFloat.
- Returns: A MotionAnimation.
*/
static
func
spin
(
_
point
:
CGPoint
,
z
:
CGFloat
=
0
)
->
MotionAnimation
{
...
...
@@ -172,7 +172,7 @@ public extension MotionAnimation {
}
/**
Animates the view's current scale to the given x, y, z scale values.
Animates the view's current scale to the given x, y,
and
z scale values.
- Parameter x: A CGFloat.
- Parameter y: A CGFloat.
- Parameter z: A CGFloat.
...
...
@@ -194,8 +194,7 @@ public extension MotionAnimation {
}
/**
Animates a view's current translation to the given
x, y, and z values.
Animates a view equal to the distance given by the x, y, and z values.
- Parameter x: A CGFloat.
- Parameter y: A CGFloat.
- Parameter z: A CGFloat.
...
...
@@ -208,10 +207,9 @@ public extension MotionAnimation {
}
/**
Animates a view's current translation to the given
point value (x & y), and a z value.
Animates a view equal to the distance given by a point and z value.
- Parameter _ point: A CGPoint.
- Parameter z: A CGFloat
, default is 0
.
- Parameter z: A CGFloat.
- Returns: A MotionAnimation.
*/
static
func
translate
(
_
point
:
CGPoint
,
z
:
CGFloat
=
0
)
->
MotionAnimation
{
...
...
@@ -346,6 +344,20 @@ public extension MotionAnimation {
}
/**
Available in iOS 9+, animates a view using the spring API,
given a stiffness and damping.
- Parameter stiffness: A CGFlloat.
- Parameter damping: A CGFloat.
- Returns: A MotionAnimation.
*/
@available(iOS 9, *)
static
func
spring
(
stiffness
:
CGFloat
,
damping
:
CGFloat
)
->
MotionAnimation
{
return
MotionAnimation
{
$0
.
spring
=
(
stiffness
,
damping
)
}
}
/**
The duration of the view's animation. If a duration of 0 is used,
the value will be converted to 0.01, to give a close to zero value.
- Parameter _ duration: A TimeInterval.
...
...
@@ -380,21 +392,7 @@ public extension MotionAnimation {
}
/**
Available in iOS 9+, animates a view using the spring API,
given a stiffness and damping.
- Parameter stiffness: A CGFlloat.
- Parameter damping: A CGFloat.
- Returns: A MotionAnimation.
*/
@available(iOS 9, *)
static
func
spring
(
stiffness
:
CGFloat
,
damping
:
CGFloat
)
->
MotionAnimation
{
return
MotionAnimation
{
$0
.
spring
=
(
stiffness
,
damping
)
}
}
/**
Creates a completion block handler that executed once tha animation
Creates a completion block handler that is executed once the animation
is done.
- Parameter _ execute: A callback to execute once completed.
*/
...
...
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