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
3d538a63
Unverified
Commit
3d538a63
authored
Feb 01, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated transform behaviour when setting up MotionTransition
parent
c7200fdf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
84 deletions
+91
-84
Sources/iOS/MotionAnimation.swift
+65
-60
Sources/iOS/MotionTransition.swift
+26
-24
No files found.
Sources/iOS/MotionAnimation.swift
View file @
3d538a63
This diff is collapsed.
Click to expand it.
Sources/iOS/MotionTransition.swift
View file @
3d538a63
...
@@ -84,17 +84,17 @@ extension UIViewController {
...
@@ -84,17 +84,17 @@ extension UIViewController {
}
}
}
}
//
extension UIViewController {
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
?
{
//
return isMotionTransitionEnabled ? MotionTransition(isPresenting: operation == .push) : nil
return
isMotionTransitionEnabled
?
MotionTransition
(
isPresenting
:
operation
==
.
push
)
:
nil
//
}
}
//
}
}
//
//
extension UIViewController {
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
?
{
//
return isMotionTransitionEnabled ? MotionTransition() : nil
return
isMotionTransitionEnabled
?
MotionTransition
()
:
nil
//
}
}
//
}
}
extension
UIView
{
extension
UIView
{
/// The global position of a view.
/// The global position of a view.
...
@@ -143,11 +143,13 @@ extension UIView {
...
@@ -143,11 +143,13 @@ extension UIView {
let
oldBackgroundColor
=
backgroundColor
let
oldBackgroundColor
=
backgroundColor
backgroundColor
=
.
clear
backgroundColor
=
.
clear
let
oldTransform
=
transform
transform
=
.
identity
let
v
=
snapshotView
(
afterScreenUpdates
:
afterUpdates
)
!
let
v
=
snapshotView
(
afterScreenUpdates
:
afterUpdates
)
!
cornerRadius
=
oldCornerRadius
cornerRadius
=
oldCornerRadius
backgroundColor
=
oldBackgroundColor
backgroundColor
=
oldBackgroundColor
v
.
backgroundColor
=
oldBackgroundColor
transform
=
oldTransform
let
contentView
=
v
.
subviews
.
first
!
let
contentView
=
v
.
subviews
.
first
!
contentView
.
cornerRadius
=
cornerRadius
contentView
.
cornerRadius
=
cornerRadius
...
@@ -169,7 +171,10 @@ extension UIView {
...
@@ -169,7 +171,10 @@ extension UIView {
v
.
shadowColor
=
shadowColor
v
.
shadowColor
=
shadowColor
v
.
shadowOffset
=
shadowOffset
v
.
shadowOffset
=
shadowOffset
v
.
contentMode
=
contentMode
v
.
contentMode
=
contentMode
v
.
layer
.
transform
=
layer
.
transform
v
.
transform
=
transform
v
.
backgroundColor
=
backgroundColor
print
(
motionRotationAngle
)
isHidden
=
true
isHidden
=
true
(
self
as?
Pulseable
)?
.
pulse
.
pulseLayer
?
.
isHidden
=
false
(
self
as?
Pulseable
)?
.
pulse
.
pulseLayer
?
.
isHidden
=
false
...
@@ -372,21 +377,18 @@ extension MotionTransition {
...
@@ -372,21 +377,18 @@ extension MotionTransition {
var
snapshotAnimations
=
[
CABasicAnimation
]()
var
snapshotAnimations
=
[
CABasicAnimation
]()
var
snapshotChildAnimations
=
[
CABasicAnimation
]()
var
snapshotChildAnimations
=
[
CABasicAnimation
]()
snapshotAnimations
.
append
(
Motion
.
position
(
to
:
tv
.
motionPosition
))
let
sizeAnimation
=
Motion
.
size
(
tv
.
bounds
.
size
)
let
sizeAnimation
=
Motion
.
size
(
tv
.
bounds
.
size
)
snapshotAnimations
.
append
(
sizeAnimation
)
let
cornerRadiusAnimation
=
Motion
.
corner
(
radius
:
tv
.
cornerRadius
)
snapshotChildAnimations
.
append
(
sizeAnimation
)
snapshotChildAnimations
.
append
(
Motion
.
position
(
x
:
tv
.
bounds
.
width
/
2
,
y
:
tv
.
bounds
.
height
/
2
))
snapshotAnimations
.
append
(
Motion
.
rotate
(
angle
:
tv
.
motionRotationAngle
))
snapshotAnimations
.
append
(
sizeAnimation
)
snapshotAnimations
.
append
(
cornerRadiusAnimation
)
snapshotAnimations
.
append
(
Motion
.
position
(
to
:
tv
.
motionPosition
))
snapshotAnimations
.
append
(
Motion
.
rotation
(
angle
:
tv
.
motionRotationAngle
))
snapshotAnimations
.
append
(
Motion
.
background
(
color
:
tv
.
backgroundColor
??
.
clear
))
snapshotAnimations
.
append
(
Motion
.
background
(
color
:
tv
.
backgroundColor
??
.
clear
))
let
cornerRadiusAnimation
=
Motion
.
corner
(
radius
:
tv
.
cornerRadius
)
snapshotAnimations
.
append
(
cornerRadiusAnimation
)
snapshotChildAnimations
.
append
(
cornerRadiusAnimation
)
snapshotChildAnimations
.
append
(
cornerRadiusAnimation
)
snapshotChildAnimations
.
append
(
sizeAnimation
)
snapshotChildAnimations
.
append
(
Motion
.
position
(
x
:
tv
.
bounds
.
width
/
2
,
y
:
tv
.
bounds
.
height
/
2
))
let
snapshot
=
fv
.
motionTransitionSnapshot
(
afterUpdates
:
true
)
let
snapshot
=
fv
.
motionTransitionSnapshot
(
afterUpdates
:
true
)
transitionView
.
insertSubview
(
snapshot
,
belowSubview
:
transitionSnapshot
)
transitionView
.
insertSubview
(
snapshot
,
belowSubview
:
transitionSnapshot
)
...
...
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