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
da69383e
Unverified
Commit
da69383e
authored
Apr 24, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added interactive boolean to trigger interactive mode with animations
parent
ae0a2079
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
Sources/iOS/Material+Motion.swift
+20
-5
No files found.
Sources/iOS/Material+Motion.swift
View file @
da69383e
...
@@ -174,7 +174,7 @@ extension UIViewController {
...
@@ -174,7 +174,7 @@ extension UIViewController {
*/
*/
open
func
animationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
,
source
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
open
func
animationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
,
source
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"animationController(forPresented"
)
print
(
"animationController(forPresented"
)
return
isMotionEnabled
?
PresentingMotion
(
isPresenting
:
true
)
:
nil
return
isMotionEnabled
?
PresentingMotion
(
isPresenting
:
true
,
isInteractive
:
isInteractiveMotionEnabled
)
:
nil
}
}
/**
/**
...
@@ -184,7 +184,7 @@ extension UIViewController {
...
@@ -184,7 +184,7 @@ extension UIViewController {
*/
*/
open
func
animationController
(
forDismissed
dismissed
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
open
func
animationController
(
forDismissed
dismissed
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"animationController(forDismissed"
)
print
(
"animationController(forDismissed"
)
return
isMotionEnabled
?
DismissingMotion
(
isPresenting
:
true
)
:
nil
return
isMotionEnabled
?
DismissingMotion
(
isPresenting
:
true
,
isInteractive
:
isInteractiveMotionEnabled
)
:
nil
}
}
/**
/**
...
@@ -221,7 +221,7 @@ extension UIViewController {
...
@@ -221,7 +221,7 @@ extension UIViewController {
*/
*/
open
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
open
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"navigationController(_ navigationController"
)
print
(
"navigationController(_ navigationController"
)
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
operation
==
.
push
)
:
nil
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
operation
==
.
push
,
isInteractive
:
fromVC
.
isInteractiveMotionEnabled
)
:
nil
}
}
/**
/**
...
@@ -233,7 +233,7 @@ extension UIViewController {
...
@@ -233,7 +233,7 @@ extension UIViewController {
*/
*/
open
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
open
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"tabBarController(_ tabBarController"
)
print
(
"tabBarController(_ tabBarController"
)
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
true
)
:
nil
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
true
,
isInteractive
:
fromVC
.
isInteractiveMotionEnabled
)
:
nil
}
}
}
}
...
@@ -388,6 +388,9 @@ open class MotionAnimator: NSObject {
...
@@ -388,6 +388,9 @@ open class MotionAnimator: NSObject {
/// A boolean indicating whether Motion is presenting a view controller.
/// A boolean indicating whether Motion is presenting a view controller.
open
fileprivate
(
set
)
var
isPresenting
:
Bool
open
fileprivate
(
set
)
var
isPresenting
:
Bool
/// A boolean indicating whether Motion is interactive.
open
fileprivate
(
set
)
var
isInteractive
:
Bool
/**
/**
An Array of UIView pairs with common motionIdentifiers in
An Array of UIView pairs with common motionIdentifiers in
the from and to view controllers.
the from and to view controllers.
...
@@ -448,6 +451,7 @@ open class MotionAnimator: NSObject {
...
@@ -448,6 +451,7 @@ open class MotionAnimator: NSObject {
/// The default initializer.
/// The default initializer.
public
override
init
()
{
public
override
init
()
{
isPresenting
=
false
isPresenting
=
false
isInteractive
=
false
super
.
init
()
super
.
init
()
}
}
...
@@ -455,9 +459,12 @@ open class MotionAnimator: NSObject {
...
@@ -455,9 +459,12 @@ open class MotionAnimator: NSObject {
An initializer to modify the presenting and container state.
An initializer to modify the presenting and container state.
- Parameter isPresenting: A boolean value indicating if the
- Parameter isPresenting: A boolean value indicating if the
Motion instance is presenting the view controller.
Motion instance is presenting the view controller.
- Parameter isInteractive: A boolean value indicating if the
Motion instance is an interactive animation.
*/
*/
public
init
(
isPresenting
:
Bool
)
{
public
init
(
isPresenting
:
Bool
,
isInteractive
:
Bool
)
{
self
.
isPresenting
=
isPresenting
self
.
isPresenting
=
isPresenting
self
.
isInteractive
=
isInteractive
super
.
init
()
super
.
init
()
}
}
...
@@ -625,11 +632,19 @@ extension MotionAnimator {
...
@@ -625,11 +632,19 @@ extension MotionAnimator {
snapshotGroup
.
isRemovedOnCompletion
=
false
snapshotGroup
.
isRemovedOnCompletion
=
false
snapshotGroup
.
timingFunction
=
MotionAnimationTimingFunctionToValue
(
timingFunction
:
tf
)
snapshotGroup
.
timingFunction
=
MotionAnimationTimingFunctionToValue
(
timingFunction
:
tf
)
if
s
.
isInteractive
{
snapshotGroup
.
speed
=
0
}
let
snapshotChildGroup
=
Motion
.
animate
(
group
:
snapshotChildAnimations
,
duration
:
d
)
let
snapshotChildGroup
=
Motion
.
animate
(
group
:
snapshotChildAnimations
,
duration
:
d
)
snapshotChildGroup
.
fillMode
=
MotionAnimationFillModeToValue
(
mode
:
.
forwards
)
snapshotChildGroup
.
fillMode
=
MotionAnimationFillModeToValue
(
mode
:
.
forwards
)
snapshotChildGroup
.
isRemovedOnCompletion
=
false
snapshotChildGroup
.
isRemovedOnCompletion
=
false
snapshotChildGroup
.
timingFunction
=
MotionAnimationTimingFunctionToValue
(
timingFunction
:
tf
)
snapshotChildGroup
.
timingFunction
=
MotionAnimationTimingFunctionToValue
(
timingFunction
:
tf
)
if
s
.
isInteractive
{
snapshotChildGroup
.
speed
=
0
}
snapshot
.
animate
(
snapshotGroup
)
snapshot
.
animate
(
snapshotGroup
)
snapshot
.
subviews
.
first
?
.
animate
(
snapshotChildGroup
)
snapshot
.
subviews
.
first
?
.
animate
(
snapshotChildGroup
)
}
}
...
...
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