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
9842a65b
Unverified
Commit
9842a65b
authored
Jan 30, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added backgroundColor to MotionTransition
parent
7be4d2c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
Sources/iOS/MotionTransition.swift
+17
-9
No files found.
Sources/iOS/MotionTransition.swift
View file @
9842a65b
...
...
@@ -133,9 +133,15 @@ extension UIView {
let
oldCornerRadius
=
cornerRadius
cornerRadius
=
0
let
oldBackgroundColor
=
backgroundColor
backgroundColor
=
.
clear
let
v
=
snapshotView
(
afterScreenUpdates
:
afterUpdates
)
!
cornerRadius
=
oldCornerRadius
backgroundColor
=
oldBackgroundColor
v
.
backgroundColor
=
oldBackgroundColor
let
contentView
=
v
.
subviews
.
first
!
contentView
.
cornerRadius
=
cornerRadius
contentView
.
masksToBounds
=
true
...
...
@@ -149,7 +155,6 @@ extension UIView {
v
.
isOpaque
=
isOpaque
v
.
anchorPoint
=
anchorPoint
v
.
masksToBounds
=
masksToBounds
v
.
backgroundColor
=
backgroundColor
v
.
borderColor
=
borderColor
v
.
borderWidth
=
borderWidth
v
.
shadowRadius
=
shadowRadius
...
...
@@ -207,6 +212,8 @@ open class MotionTransitionPresentationController: UIPresentationController {
open
class
MotionTransition
:
NSObject
{
open
var
isPresenting
=
false
open
let
backgroundView
=
UIView
()
open
var
toViewController
:
UIViewController
!
open
var
fromViewController
:
UIViewController
!
...
...
@@ -324,8 +331,6 @@ extension MotionTransition: UIViewControllerAnimatedTransitioning {
}
open
class
MotionTransitionPresentedAnimator
:
MotionTransition
{
open
let
backgroundView
=
UIView
()
@objc(animateTransition:)
open
override
func
animateTransition
(
using
transitionContext
:
UIViewControllerContextTransitioning
)
{
super
.
animateTransition
(
using
:
transitionContext
)
...
...
@@ -376,6 +381,8 @@ open class MotionTransitionPresentedAnimator: MotionTransition {
snapshotAnimations
.
append
(
Motion
.
rotate
(
angle
:
tv
.
motionRotationAngle
))
snapshotAnimations
.
append
(
Motion
.
background
(
color
:
tv
.
backgroundColor
??
.
clear
))
let
cornerRadiusAnimation
=
Motion
.
corner
(
radius
:
tv
.
cornerRadius
)
snapshotAnimations
.
append
(
cornerRadiusAnimation
)
snapshotChildAnimations
.
append
(
cornerRadiusAnimation
)
...
...
@@ -443,10 +450,9 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
transitionView
.
isHidden
=
true
let
bgView
=
UIView
()
bgView
.
backgroundColor
=
fromView
.
backgroundColor
bgView
.
frame
=
transitionView
.
bounds
transitionView
.
addSubview
(
bgView
)
backgroundView
.
backgroundColor
=
fromView
.
backgroundColor
backgroundView
.
frame
=
transitionView
.
bounds
transitionView
.
addSubview
(
backgroundView
)
toView
.
updateConstraints
()
toView
.
setNeedsLayout
()
...
...
@@ -487,6 +493,8 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
snapshotAnimations
.
append
(
Motion
.
rotate
(
angle
:
tv
.
motionRotationAngle
))
snapshotAnimations
.
append
(
Motion
.
background
(
color
:
tv
.
backgroundColor
??
.
clear
))
let
cornerRadiusAnimation
=
Motion
.
corner
(
radius
:
tv
.
cornerRadius
)
snapshotAnimations
.
append
(
cornerRadiusAnimation
)
snapshotChildAnimations
.
append
(
cornerRadiusAnimation
)
...
...
@@ -526,8 +534,8 @@ open class MotionTransitionDismissedAnimator: MotionTransition {
let
d
=
transitionDuration
(
using
:
transitionContext
)
if
nil
!=
b
g
View
.
backgroundColor
{
b
g
View
.
motion
(
.
backgroundColor
(
.
clear
),
.
duration
(
d
))
if
nil
!=
b
ackground
View
.
backgroundColor
{
b
ackground
View
.
motion
(
.
backgroundColor
(
.
clear
),
.
duration
(
d
))
}
Motion
.
delay
(
d
)
{
[
weak
self
]
in
...
...
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