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
7a6f9cbd
Unverified
Commit
7a6f9cbd
authored
Jun 28, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated MotionAnimation and MotionTransition APIs
parent
06f6c0cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
114 deletions
+91
-114
Sources/Extensions/Motion+CALayer.swift
+44
-68
Sources/MotionAnimation.swift
+0
-0
Sources/MotionAnimationState.swift
+7
-7
Sources/MotionTransition.swift
+13
-12
Sources/MotionTransitionState.swift
+7
-7
Sources/TransitionPreprocessor.swift
+20
-20
No files found.
Sources/Extensions/Motion+CALayer.swift
View file @
7a6f9cbd
...
@@ -155,7 +155,7 @@ fileprivate extension CALayer {
...
@@ -155,7 +155,7 @@ fileprivate extension CALayer {
return
return
}
}
var
a
=
[
CABasicAnimation
]()
var
a
nims
=
[
CABasicAnimation
]()
let
tf
:
CAMediaTimingFunction
=
targetState
.
timingFunction
??
CAMediaTimingFunction
.
from
(
mediaTimingFunctionType
:
timingFunction
)
let
tf
:
CAMediaTimingFunction
=
targetState
.
timingFunction
??
CAMediaTimingFunction
.
from
(
mediaTimingFunctionType
:
timingFunction
)
let
d
:
TimeInterval
=
targetState
.
duration
??
duration
let
d
:
TimeInterval
=
targetState
.
duration
??
duration
//
//
...
@@ -183,92 +183,68 @@ fileprivate extension CALayer {
...
@@ -183,92 +183,68 @@ fileprivate extension CALayer {
// }
// }
//
//
if
let
v
=
targetState
.
backgroundColor
{
if
let
v
=
targetState
.
backgroundColor
{
let
a
nim
=
MotionBasicAnimation
.
background
(
color
:
UIColor
(
cgColor
:
v
))
let
a
=
MotionBasicAnimation
.
background
(
color
:
UIColor
(
cgColor
:
v
))
a
nim
.
fromValue
=
s
.
backgroundColor
a
.
fromValue
=
s
.
backgroundColor
a
.
append
(
anim
)
a
nims
.
append
(
a
)
}
}
if
let
v
=
targetState
.
borderColor
{
if
let
v
=
targetState
.
borderColor
{
let
a
nim
=
MotionBasicAnimation
.
border
(
color
:
UIColor
(
cgColor
:
v
))
let
a
=
MotionBasicAnimation
.
border
(
color
:
UIColor
(
cgColor
:
v
))
a
nim
.
fromValue
=
s
.
borderColor
a
.
fromValue
=
s
.
borderColor
a
.
append
(
anim
)
a
nims
.
append
(
a
)
}
}
if
let
v
=
targetState
.
borderWidth
{
if
let
v
=
targetState
.
borderWidth
{
let
a
nim
=
MotionBasicAnimation
.
border
(
width
:
v
)
let
a
=
MotionBasicAnimation
.
border
(
width
:
v
)
a
nim
.
fromValue
=
NSNumber
(
floatLiteral
:
Double
(
s
.
borderWidth
))
a
.
fromValue
=
NSNumber
(
floatLiteral
:
Double
(
s
.
borderWidth
))
a
.
append
(
anim
)
a
nims
.
append
(
a
)
}
}
if
let
v
=
targetState
.
cornerRadius
{
if
let
v
=
targetState
.
cornerRadius
{
let
a
nim
=
MotionBasicAnimation
.
corner
(
radius
:
v
)
let
a
=
MotionBasicAnimation
.
corner
(
radius
:
v
)
a
nim
.
fromValue
=
NSNumber
(
floatLiteral
:
Double
(
s
.
cornerRadius
))
a
.
fromValue
=
NSNumber
(
floatLiteral
:
Double
(
s
.
cornerRadius
))
a
.
append
(
anim
)
a
nims
.
append
(
a
)
}
}
if
let
v
=
targetState
.
transform
{
if
let
v
=
targetState
.
transform
{
let
a
nim
=
MotionBasicAnimation
.
transform
(
transform
:
v
)
let
a
=
MotionBasicAnimation
.
transform
(
v
)
a
nim
.
fromValue
=
NSValue
(
caTransform3D
:
s
.
transform
)
a
.
fromValue
=
NSValue
(
caTransform3D
:
s
.
transform
)
a
.
append
(
anim
)
a
nims
.
append
(
a
)
}
}
if
let
v
=
targetState
.
spin
{
if
let
v
=
targetState
.
spin
{
var
a
nim
=
MotionBasicAnimation
.
spinX
(
rotates
:
v
.
0
)
var
a
=
MotionBasicAnimation
.
spinX
(
v
.
0
)
a
nim
.
fromValue
=
0
a
.
fromValue
=
NSNumber
(
floatLiteral
:
0
)
a
.
append
(
anim
)
a
nims
.
append
(
a
)
a
nim
=
MotionBasicAnimation
.
spinY
(
rotates
:
v
.
1
)
a
=
MotionBasicAnimation
.
spinY
(
v
.
1
)
a
nim
.
fromValue
=
0
a
.
fromValue
=
NSNumber
(
floatLiteral
:
0
)
a
.
append
(
anim
)
a
nims
.
append
(
a
)
a
nim
=
MotionBasicAnimation
.
spinZ
(
rotates
:
v
.
2
)
a
=
MotionBasicAnimation
.
spinZ
(
v
.
2
)
a
nim
.
fromValue
=
0
a
.
fromValue
=
NSNumber
(
floatLiteral
:
0
)
a
.
append
(
anim
)
a
nims
.
append
(
a
)
}
}
if
let
v
=
targetState
.
position
{
let
a
=
MotionBasicAnimation
.
position
(
v
)
a
.
fromValue
=
NSValue
(
cgPoint
:
s
.
position
)
anims
.
append
(
a
)
}
//
if
let
v
=
targetState
.
opacity
{
// case let .scale(to):
let
a
=
MotionBasicAnimation
.
fade
(
v
)
// a.append(MotionBasicAnimation.scale(to: to))
a
.
fromValue
=
s
.
value
(
forKeyPath
:
MotionAnimationKeyPath
.
opacity
.
rawValue
)
??
NSNumber
(
floatLiteral
:
1
)
//
anims
.
append
(
a
)
// case let .scaleX(to):
}
// a.append(MotionBasicAnimation.scaleX(to: to))
//
if
let
v
=
targetState
.
zPosition
{
// case let .scaleY(to):
let
a
=
MotionBasicAnimation
.
zPosition
(
v
)
// a.append(MotionBasicAnimation.scaleY(to: to))
a
.
fromValue
=
s
.
value
(
forKeyPath
:
MotionAnimationKeyPath
.
zPosition
.
rawValue
)
??
NSNumber
(
floatLiteral
:
0
)
//
anims
.
append
(
a
)
// case let .scaleZ(to):
}
// a.append(MotionBasicAnimation.scaleZ(to: to))
//
// case let .translate(x, y):
// a.append(MotionBasicAnimation.translate(to: CGPoint(x: x, y: y)))
//
// case let .translateX(to):
// a.append(MotionBasicAnimation.translateX(to: to))
//
// case let .translateY(to):
// a.append(MotionBasicAnimation.translateY(to: to))
//
// case let .translateZ(to):
// a.append(MotionBasicAnimation.translateZ(to: to))
//
// case .x(_), .y(_), .point(_, _):
// let position = MotionBasicAnimation.position(to: CGPoint(x: px, y: py))
// a.append(position)
//
// case let .position(x, y):
// a.append(MotionBasicAnimation.position(to: CGPoint(x: x, y: y)))
//
// case let .fade(opacity):
// let fade = MotionBasicAnimation.fade(to: opacity)
// fade.fromValue = s.value(forKey: MotionAnimationKeyPath.opacity.rawValue) ?? NSNumber(floatLiteral: 1)
// a.append(fade)
//
// case let .zPosition(position):
// let zPosition = MotionBasicAnimation.zPosition(position)
// zPosition.fromValue = s.value(forKey: MotionAnimationKeyPath.zPosition.rawValue) ?? NSNumber(value: 0)
// a.append(zPosition)
//
// case .width(_), .height(_), .size(_, _):
// case .width(_), .height(_), .size(_, _):
// a.append(MotionBasicAnimation.size(CGSize(width: w, height: h)))
// a.append(MotionBasicAnimation.size(CGSize(width: w, height: h)))
//
//
...
@@ -318,7 +294,7 @@ fileprivate extension CALayer {
...
@@ -318,7 +294,7 @@ fileprivate extension CALayer {
// }
// }
// }
// }
//
//
let
g
=
Motion
.
animate
(
group
:
a
,
duration
:
d
)
let
g
=
Motion
.
animate
(
group
:
a
nims
,
duration
:
d
)
g
.
fillMode
=
MotionAnimationFillModeToValue
(
mode
:
.
forwards
)
g
.
fillMode
=
MotionAnimationFillModeToValue
(
mode
:
.
forwards
)
g
.
isRemovedOnCompletion
=
false
g
.
isRemovedOnCompletion
=
false
g
.
timingFunction
=
tf
g
.
timingFunction
=
tf
...
...
Sources/MotionAnimation.swift
View file @
7a6f9cbd
This diff is collapsed.
Click to expand it.
Sources/MotionAnimationState.swift
View file @
7a6f9cbd
...
@@ -42,7 +42,7 @@ public struct MotionAnimationState {
...
@@ -42,7 +42,7 @@ public struct MotionAnimationState {
public
var
spin
:
(
CGFloat
,
CGFloat
,
CGFloat
)?
public
var
spin
:
(
CGFloat
,
CGFloat
,
CGFloat
)?
/// A reference to the opacity.
/// A reference to the opacity.
public
var
opacity
:
Float
?
public
var
opacity
:
Double
?
/// A reference to the cornerRadius.
/// A reference to the cornerRadius.
public
var
cornerRadius
:
CGFloat
?
public
var
cornerRadius
:
CGFloat
?
...
@@ -113,18 +113,18 @@ public struct MotionAnimationState {
...
@@ -113,18 +113,18 @@ public struct MotionAnimationState {
extension
MotionAnimationState
{
extension
MotionAnimationState
{
/**
/**
Adds a MotionAnimation to the current state.
Adds a MotionAnimation to the current state.
- Parameter _
animation
: A MotionAnimation.
- Parameter _
element
: A MotionAnimation.
*/
*/
public
mutating
func
append
(
_
animation
:
MotionAnimation
)
{
public
mutating
func
append
(
_
element
:
MotionAnimation
)
{
animation
.
apply
(
&
self
)
element
.
apply
(
&
self
)
}
}
/**
/**
Adds an Array of MotionAnimations to the current state.
Adds an Array of MotionAnimations to the current state.
- Parameter contentsOf
animation
s: An Array of MotionAnimations.
- Parameter contentsOf
element
s: An Array of MotionAnimations.
*/
*/
public
mutating
func
append
(
contentsOf
animation
s
:
[
MotionAnimation
])
{
public
mutating
func
append
(
contentsOf
element
s
:
[
MotionAnimation
])
{
for
v
in
animation
s
{
for
v
in
element
s
{
v
.
apply
(
&
self
)
v
.
apply
(
&
self
)
}
}
}
}
...
...
Sources/MotionTransition.swift
View file @
7a6f9cbd
...
@@ -191,11 +191,11 @@ extension MotionTransition {
...
@@ -191,11 +191,11 @@ extension MotionTransition {
/**
/**
Animates the view's current x & y scale to the given scale value.
Animates the view's current x & y scale to the given scale value.
- Parameter
to scale
: A CGFloat.
- Parameter
_ xy
: A CGFloat.
- Returns: A MotionTransition.
- Returns: A MotionTransition.
*/
*/
public
static
func
scale
(
to
scale
:
CGFloat
)
->
MotionTransition
{
public
static
func
scale
(
_
xy
:
CGFloat
)
->
MotionTransition
{
return
.
scale
(
x
:
scale
,
y
:
scale
)
return
.
scale
(
x
:
xy
,
y
:
xy
)
}
}
/**
/**
...
@@ -215,20 +215,20 @@ extension MotionTransition {
...
@@ -215,20 +215,20 @@ extension MotionTransition {
/**
/**
Animates the view's current translation to the given
Animates the view's current translation to the given
point value (x & y), and a z value.
point value (x & y), and a z value.
- Parameter
to
point: A CGPoint.
- Parameter
_
point: A CGPoint.
- Parameter z: A CGFloat, default is 0.
- Parameter z: A CGFloat, default is 0.
- Returns: A MotionTransition.
- Returns: A MotionTransition.
*/
*/
public
static
func
translate
(
to
point
:
CGPoint
,
z
:
CGFloat
=
0
)
->
MotionTransition
{
public
static
func
translate
(
_
point
:
CGPoint
,
z
:
CGFloat
=
0
)
->
MotionTransition
{
return
.
translate
(
x
:
point
.
x
,
y
:
point
.
y
,
z
:
z
)
return
.
translate
(
x
:
point
.
x
,
y
:
point
.
y
,
z
:
z
)
}
}
/**
/**
Animates the view's current position to the given point.
Animates the view's current position to the given point.
- Parameter
to
point: A CGPoint.
- Parameter
_
point: A CGPoint.
- Returns: A MotionTransition.
- Returns: A MotionTransition.
*/
*/
public
static
func
position
(
to
point
:
CGPoint
)
->
MotionTransition
{
public
static
func
position
(
_
point
:
CGPoint
)
->
MotionTransition
{
return
MotionTransition
{
return
MotionTransition
{
$0
.
position
=
point
$0
.
position
=
point
}
}
...
@@ -239,17 +239,18 @@ extension MotionTransition {
...
@@ -239,17 +239,18 @@ extension MotionTransition {
$0
.
nonFade
=
true
$0
.
nonFade
=
true
}
}
/// Fades the view in during a transition.
public
static
var
fadeIn
=
MotionTransition
.
fade
(
1
)
/// Fades the view out during a transition.
/// Fades the view out during a transition.
public
static
var
fade
=
MotionTransition
{
public
static
var
fadeOut
=
MotionTransition
.
fade
(
0
)
$0
.
opacity
=
0
}
/**
/**
Animates the view's current opacity to the given one.
Animates the view's current opacity to the given one.
- Parameter to opacity: A
Float
value.
- Parameter to opacity: A
Double
value.
- Returns: A MotionTransition.
- Returns: A MotionTransition.
*/
*/
public
static
func
fade
(
to
opacity
:
Float
)
->
MotionTransition
{
public
static
func
fade
(
_
opacity
:
Double
)
->
MotionTransition
{
return
MotionTransition
{
return
MotionTransition
{
$0
.
opacity
=
opacity
$0
.
opacity
=
opacity
}
}
...
...
Sources/MotionTransitionState.swift
View file @
7a6f9cbd
...
@@ -58,7 +58,7 @@ public struct MotionTransitionState {
...
@@ -58,7 +58,7 @@ public struct MotionTransitionState {
public
var
transform
:
CATransform3D
?
public
var
transform
:
CATransform3D
?
/// A reference to the opacity.
/// A reference to the opacity.
public
var
opacity
:
Float
?
public
var
opacity
:
Double
?
/// A reference to the cornerRadius.
/// A reference to the cornerRadius.
public
var
cornerRadius
:
CGFloat
?
public
var
cornerRadius
:
CGFloat
?
...
@@ -162,18 +162,18 @@ public struct MotionTransitionState {
...
@@ -162,18 +162,18 @@ public struct MotionTransitionState {
extension
MotionTransitionState
{
extension
MotionTransitionState
{
/**
/**
Adds a MotionTransition to the current state.
Adds a MotionTransition to the current state.
- Parameter _
transition
: A MotionTransition.
- Parameter _
element
: A MotionTransition.
*/
*/
public
mutating
func
append
(
_
transition
:
MotionTransition
)
{
public
mutating
func
append
(
_
element
:
MotionTransition
)
{
transition
.
apply
(
&
self
)
element
.
apply
(
&
self
)
}
}
/**
/**
Adds an Array of MotionTransitions to the current state.
Adds an Array of MotionTransitions to the current state.
- Parameter contentsOf
transition
s: An Array of MotionTransitions.
- Parameter contentsOf
element
s: An Array of MotionTransitions.
*/
*/
public
mutating
func
append
(
contentsOf
transition
s
:
[
MotionTransition
])
{
public
mutating
func
append
(
contentsOf
element
s
:
[
MotionTransition
])
{
for
v
in
transition
s
{
for
v
in
element
s
{
v
.
apply
(
&
self
)
v
.
apply
(
&
self
)
}
}
}
}
...
...
Sources/TransitionPreprocessor.swift
View file @
7a6f9cbd
...
@@ -261,37 +261,37 @@ class TransitionPreprocessor: MotionPreprocessor {
...
@@ -261,37 +261,37 @@ class TransitionPreprocessor: MotionPreprocessor {
switch
defaultAnimation
{
switch
defaultAnimation
{
case
.
push
(
let
direction
):
case
.
push
(
let
direction
):
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
true
)),
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
true
)),
.
shadow
(
opacity
:
0
),
.
shadow
(
opacity
:
0
),
.
beginWith
(
transitions
:
shadowState
),
.
beginWith
(
transitions
:
shadowState
),
.
timingFunction
(
.
deceleration
)])
.
timingFunction
(
.
deceleration
)])
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
false
)
/
3
),
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
false
)
/
3
),
.
overlay
(
color
:
.
black
,
opacity
:
0.1
),
.
overlay
(
color
:
.
black
,
opacity
:
0.1
),
.
timingFunction
(
.
deceleration
)])
.
timingFunction
(
.
deceleration
)])
case
.
pull
(
let
direction
):
case
.
pull
(
let
direction
):
m
.
insertToViewFirst
=
true
m
.
insertToViewFirst
=
true
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
false
)),
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
false
)),
.
shadow
(
opacity
:
0
),
.
shadow
(
opacity
:
0
),
.
beginWith
(
transitions
:
shadowState
)])
.
beginWith
(
transitions
:
shadowState
)])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
true
)
/
3
),
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
true
)
/
3
),
.
overlay
(
color
:
.
black
,
opacity
:
0.1
)])
.
overlay
(
color
:
.
black
,
opacity
:
0.1
)])
case
.
slide
(
let
direction
):
case
.
slide
(
let
direction
):
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
false
))])
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
false
))])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
true
))])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
true
))])
case
.
zoomSlide
(
let
direction
):
case
.
zoomSlide
(
let
direction
):
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
false
)),
.
scale
(
to
:
0.8
)])
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
false
)),
.
scale
(
0.8
)])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
true
)),
.
scale
(
to
:
0.8
)])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
true
)),
.
scale
(
0.8
)])
case
.
cover
(
let
direction
):
case
.
cover
(
let
direction
):
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
true
)),
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
true
)),
.
shadow
(
opacity
:
0
),
.
shadow
(
opacity
:
0
),
.
beginWith
(
transitions
:
shadowState
),
.
beginWith
(
transitions
:
shadowState
),
.
timingFunction
(
.
deceleration
)])
.
timingFunction
(
.
deceleration
)])
...
@@ -302,43 +302,43 @@ class TransitionPreprocessor: MotionPreprocessor {
...
@@ -302,43 +302,43 @@ class TransitionPreprocessor: MotionPreprocessor {
case
.
uncover
(
let
direction
):
case
.
uncover
(
let
direction
):
m
.
insertToViewFirst
=
true
m
.
insertToViewFirst
=
true
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
false
)),
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
false
)),
.
shadow
(
opacity
:
0
),
.
shadow
(
opacity
:
0
),
.
beginWith
(
transitions
:
shadowState
)])
.
beginWith
(
transitions
:
shadowState
)])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
overlay
(
color
:
.
black
,
opacity
:
0.1
)])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
overlay
(
color
:
.
black
,
opacity
:
0.1
)])
case
.
pageIn
(
let
direction
):
case
.
pageIn
(
let
direction
):
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
true
)),
context
[
tv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
true
)),
.
shadow
(
opacity
:
0
),
.
shadow
(
opacity
:
0
),
.
beginWith
(
transitions
:
shadowState
),
.
beginWith
(
transitions
:
shadowState
),
.
timingFunction
(
.
deceleration
)])
.
timingFunction
(
.
deceleration
)])
context
[
fv
]
!.
append
(
contentsOf
:
[
.
scale
(
to
:
0.7
),
context
[
fv
]
!.
append
(
contentsOf
:
[
.
scale
(
0.7
),
.
overlay
(
color
:
.
black
,
opacity
:
0.1
),
.
overlay
(
color
:
.
black
,
opacity
:
0.1
),
.
timingFunction
(
.
deceleration
)])
.
timingFunction
(
.
deceleration
)])
case
.
pageOut
(
let
direction
):
case
.
pageOut
(
let
direction
):
m
.
insertToViewFirst
=
true
m
.
insertToViewFirst
=
true
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
to
:
shift
(
direction
:
direction
,
isAppearing
:
false
)),
context
[
fv
]
!.
append
(
contentsOf
:
[
.
translate
(
shift
(
direction
:
direction
,
isAppearing
:
false
)),
.
shadow
(
opacity
:
0
),
.
shadow
(
opacity
:
0
),
.
beginWith
(
transitions
:
shadowState
)])
.
beginWith
(
transitions
:
shadowState
)])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
scale
(
to
:
0.7
),
context
[
tv
]
!.
append
(
contentsOf
:
[
.
scale
(
0.7
),
.
overlay
(
color
:
.
black
,
opacity
:
0.1
)])
.
overlay
(
color
:
.
black
,
opacity
:
0.1
)])
case
.
fade
:
case
.
fade
:
// TODO: clean up this. overFullScreen logic shouldn't be here
// TODO: clean up this. overFullScreen logic shouldn't be here
if
!
(
fromOverFullScreen
&&
!
isPresenting
)
{
if
!
(
fromOverFullScreen
&&
!
isPresenting
)
{
context
[
tv
]
=
[
.
fade
]
context
[
tv
]
=
[
.
fade
Out
]
}
}
#if os(tvOS)
#if os(tvOS)
context
[
fromView
]
=
[
.
fade
]
context
[
fromView
]
=
[
.
fade
]
#else
#else
if
(
!
isPresenting
&&
toOverFullScreen
)
||
!
fv
.
isOpaque
||
(
fv
.
backgroundColor
?
.
alphaComponent
??
1
)
<
1
{
if
(
!
isPresenting
&&
toOverFullScreen
)
||
!
fv
.
isOpaque
||
(
fv
.
backgroundColor
?
.
alphaComponent
??
1
)
<
1
{
context
[
fv
]
=
[
.
fade
]
context
[
fv
]
=
[
.
fade
Out
]
}
}
#endif
#endif
...
@@ -347,12 +347,12 @@ class TransitionPreprocessor: MotionPreprocessor {
...
@@ -347,12 +347,12 @@ class TransitionPreprocessor: MotionPreprocessor {
case
.
zoom
:
case
.
zoom
:
m
.
insertToViewFirst
=
true
m
.
insertToViewFirst
=
true
context
[
fv
]
!.
append
(
contentsOf
:
[
.
scale
(
to
:
1.3
),
.
fade
])
context
[
fv
]
!.
append
(
contentsOf
:
[
.
scale
(
1.3
),
.
fadeOut
])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
scale
(
to
:
0.7
)])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
scale
(
0.7
)])
case
.
zoomOut
:
case
.
zoomOut
:
context
[
tv
]
!.
append
(
contentsOf
:
[
.
scale
(
to
:
1.3
),
.
fade
])
context
[
tv
]
!.
append
(
contentsOf
:
[
.
scale
(
1.3
),
.
fadeOut
])
context
[
fv
]
!.
append
(
contentsOf
:
[
.
scale
(
to
:
0.7
)])
context
[
fv
]
!.
append
(
contentsOf
:
[
.
scale
(
0.7
)])
default
:
default
:
fatalError
(
"Not implemented"
)
fatalError
(
"Not implemented"
)
...
...
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