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
63316063
Unverified
Commit
63316063
authored
Jun 11, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reworked MatchPreprocessor
parent
936c5b62
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
22 deletions
+27
-22
Sources/Animator/MotionAnimator.swift
+1
-1
Sources/Animator/MotionDefaultAnimator.swift
+1
-1
Sources/Animator/MotionHasInsertOrder.swift
+1
-1
Sources/Motion.swift
+3
-3
Sources/MotionContext.swift
+1
-1
Sources/MotionController.swift
+2
-2
Sources/Preprocessors/MatchPreprocessor.swift
+18
-13
No files found.
Sources/Animator/MotionAnimator.swift
View file @
63316063
...
...
@@ -44,7 +44,7 @@ public protocol MotionAnimator: class {
func
canAnimate
(
view
:
UIView
,
isAppearing
:
Bool
)
->
Bool
/**
Animates the from
-views to the to-v
iews.
Animates the from
Views to the toV
iews.
- Parameter fromViews: An Array of UIViews.
- Parameter toViews: An Array of UIViews.
- Returns: A TimeInterval.
...
...
Sources/Animator/MotionDefaultAnimator.swift
View file @
63316063
...
...
@@ -81,7 +81,7 @@ extension MotionDefaultAnimator {
}
/**
Animates the from
-views to the to-v
iews.
Animates the from
Views to the toV
iews.
- Parameter fromViews: An Array of UIViews.
- Parameter toViews: An Array of UIViews.
- Returns: A TimeInterval.
...
...
Sources/Animator/MotionHasInsertOrder.swift
View file @
63316063
...
...
@@ -27,6 +27,6 @@
*/
internal
protocol
MotionHasInsertOrder
:
class
{
/// A boolean indicating whether to insert the to
-v
iew first or not.
/// A boolean indicating whether to insert the to
V
iew first or not.
var
insertToViewFirst
:
Bool
{
get
set
}
}
Sources/Motion.swift
View file @
63316063
...
...
@@ -174,7 +174,7 @@ public class Motion: MotionController {
*/
internal
var
forceNonInteractive
=
false
/// Inserts the to
-v
iews first.
/// Inserts the to
V
iews first.
internal
var
insertToViewFirst
=
false
/// Indicates whether a UINavigationController is transitioning.
...
...
@@ -198,12 +198,12 @@ public class Motion: MotionController {
return
!
isContainerController
&&
(
.
overFullScreen
==
toViewController
!.
modalPresentationStyle
||
.
overCurrentContext
==
toViewController
!.
modalPresentationStyle
)
}
/// A reference to the from
-v
iew, fromViewController.view.
/// A reference to the from
V
iew, fromViewController.view.
internal
var
fromView
:
UIView
{
return
fromViewController
!.
view
}
/// A reference to the to
-v
iew, toViewController.view.
/// A reference to the to
V
iew, toViewController.view.
internal
var
toView
:
UIView
{
return
toViewController
!.
view
}
...
...
Sources/MotionContext.swift
View file @
63316063
...
...
@@ -70,7 +70,7 @@ public class MotionContext {
internal
extension
MotionContext
{
/**
Sets the from
-views and to-v
iews within the transition context.
Sets the from
Views and toV
iews within the transition context.
- Parameter fromViews: An Array of UIViews.
- Parameter toViews: An Array of UIViews.
*/
...
...
Sources/MotionController.swift
View file @
63316063
...
...
@@ -115,7 +115,7 @@ public class MotionController: NSObject {
/// An Array of MotionPlugins used during a transition.
internal
var
plugins
:
[
MotionPlugin
]
!
/// The matching from
-views to to-v
iews based on the motionIdentifier value.
/// The matching from
Views to toV
iews based on the motionIdentifier value.
internal
var
transitionPairs
:
[(
fromViews
:
[
UIView
],
toViews
:
[
UIView
])]
!
/// Plugins that are enabled during the transition.
...
...
@@ -320,7 +320,7 @@ internal extension MotionController {
preparePlugins
()
}
/// Prepares the transition from
-view & to-v
iew pairs.
/// Prepares the transition from
View & toV
iew pairs.
func
prepareTransitionPairs
()
{
guard
isTransitioning
else
{
fatalError
()
...
...
Sources/Preprocessors/MatchPreprocessor.swift
View file @
63316063
...
...
@@ -33,45 +33,50 @@ class MatchPreprocessor: MotionPreprocessor {
weak
var
context
:
MotionContext
!
/**
Implementation for processor
.
Processes the transitionary views
.
- Parameter fromViews: An Array of UIViews.
- Parameter toViews: An Array of UIViews.
*/
func
process
(
fromViews
:
[
UIView
],
toViews
:
[
UIView
])
{
for
tv
in
toViews
{
guard
let
i
d
=
tv
.
motionIdentifier
,
let
fv
=
context
.
sourceView
(
for
:
id
)
else
{
continue
}
guard
let
i
=
tv
.
motionIdentifier
,
let
fv
=
context
.
sourceView
(
for
:
i
)
else
{
continue
}
var
tvState
=
context
[
tv
]
??
MotionTransitionState
()
var
fvState
=
context
[
fv
]
??
MotionTransitionState
()
if
let
beginStateIfMatched
=
tvState
.
beginStateIfMatched
{
tvState
.
append
(
.
beginWith
(
transitions
:
beginStateIfMatched
))
if
let
v
=
tvState
.
beginStateIfMatched
{
tvState
.
append
(
.
beginWith
(
transitions
:
v
))
}
if
let
beginStateIfMatched
=
fvState
.
beginStateIfMatched
{
fvState
.
append
(
.
beginWith
(
transitions
:
beginStateIfMatched
))
if
let
v
=
fvState
.
beginStateIfMatched
{
fvState
.
append
(
.
beginWith
(
transitions
:
v
))
}
// match is just a two-way source effect
tvState
.
motionIdentifier
=
id
fvState
.
motionIdentifier
=
id
tvState
.
motionIdentifier
=
i
tvState
.
opacity
=
0
fvState
.
motionIdentifier
=
i
fvState
.
arc
=
tvState
.
arc
fvState
.
duration
=
tvState
.
duration
fvState
.
timingFunction
=
tvState
.
timingFunction
fvState
.
delay
=
tvState
.
delay
fvState
.
spring
=
tvState
.
spring
tvState
.
opacity
=
0
let
forceNonFade
=
tvState
.
nonFade
||
fvState
.
nonFade
let
isNonOpaque
=
!
fv
.
isOpaque
||
fv
.
alpha
<
1
||
!
tv
.
isOpaque
||
tv
.
alpha
<
1
if
!
forceNonFade
&&
isNonOpaque
{
//
cross fade if from/toViews are not opaque
//
Cross fade if from/toViews are not opaque.
fvState
.
opacity
=
0
}
else
{
//
n
o cross fade in this case, fromView is always displayed during the transition.
//
N
o cross fade in this case, fromView is always displayed during the transition.
fvState
.
opacity
=
nil
// we dont want two shadows showing up. Therefore we disable toView's shadow when fromView is able to display its shadow
/**
We dont want two shadows showing up. Therefore we disable toView's
shadow when fromView is able to display its shadow.
*/
if
!
fv
.
layer
.
masksToBounds
&&
fvState
.
displayShadow
{
tvState
.
displayShadow
=
false
}
...
...
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