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
af4d74d4
Commit
af4d74d4
authored
Dec 19, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates to MotionCoreAnimationViewContext
parent
c10fe806
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
12 deletions
+8
-12
Sources/Animator/MotionCoreAnimationViewContext.swift
+6
-11
Sources/Animator/MotionViewPropertyViewContext.swift
+1
-1
Sources/Extensions/Motion+CALayer.swift
+1
-0
No files found.
Sources/Animator/MotionCoreAnimationViewContext.swift
View file @
af4d74d4
...
...
@@ -118,7 +118,7 @@ internal class MotionCoreAnimationViewContext: MotionAnimatorViewContext {
for
(
layer
,
key
,
anim
)
in
animations
{
anim
.
speed
=
0
anim
.
timeOffset
=
CFTimeInterval
(
timeOffset
.
clamp
(
0
,
CGFloat
(
anim
.
duration
)
-
0.001
))
anim
.
timeOffset
=
CFTimeInterval
(
timeOffset
.
clamp
(
0
,
CGFloat
(
anim
.
duration
-
0.001
)
))
layer
.
removeAnimation
(
forKey
:
key
)
layer
.
add
(
anim
,
forKey
:
key
)
}
...
...
@@ -360,8 +360,6 @@ fileprivate extension MotionCoreAnimationViewContext {
addAnimation
(
anim
,
for
:
overlayKey
,
to
:
getOverlayLayer
())
}
else
{
snapshot
.
layer
.
add
(
anim
,
forKey
:
key
)
switch
key
{
case
"cornerRadius"
,
"contentsRect"
,
"contentsScale"
:
addAnimation
(
anim
,
for
:
key
,
to
:
snapshot
.
layer
)
...
...
@@ -375,21 +373,18 @@ fileprivate extension MotionCoreAnimationViewContext {
}
case
"bounds.size"
:
guard
let
fs
=
(
fromValue
as?
NSValue
)?
.
cgSizeValue
else
{
return
0
}
guard
let
ts
=
(
toValue
as?
NSValue
)?
.
cgSizeValue
else
{
return
0
guard
let
fromSize
=
(
fromValue
as?
NSValue
)?
.
cgSizeValue
,
let
toSize
=
(
toValue
as?
NSValue
)?
.
cgSizeValue
else
{
addAnimation
(
anim
,
for
:
key
,
to
:
snapshot
.
layer
)
break
}
setSize
(
view
:
snapshot
,
newSize
:
f
s
)
setSize
(
view
:
snapshot
,
newSize
:
f
romSize
)
uiViewBasedAnimate
(
duration
:
anim
.
duration
,
delay
:
beginTime
-
currentTime
)
{
[
weak
self
]
in
guard
let
`
self
`
=
self
else
{
return
}
self
.
setSize
(
view
:
self
.
snapshot
,
newSize
:
t
s
)
self
.
setSize
(
view
:
self
.
snapshot
,
newSize
:
t
oSize
)
}
default
:
...
...
Sources/Animator/MotionViewPropertyViewContext.swift
View file @
af4d74d4
...
...
@@ -83,7 +83,7 @@ internal class MotionViewPropertyViewContext: MotionAnimatorViewContext {
}
let
appearedEffect
=
visualEffectView
.
effect
let
disappearedEffect
=
targetState
.
opacity
==
0
?
nil
:
visualEffectView
.
effect
let
disappearedEffect
=
0
==
targetState
.
opacity
?
nil
:
visualEffectView
.
effect
startEffect
=
isAppearing
?
disappearedEffect
:
appearedEffect
endEffect
=
isAppearing
?
appearedEffect
:
disappearedEffect
...
...
Sources/Extensions/Motion+CALayer.swift
View file @
af4d74d4
...
...
@@ -29,6 +29,7 @@ import UIKit
extension
CALayer
:
CAAnimationDelegate
{}
internal
extension
CALayer
{
/// Swizzle the `add(_:forKey:) selector.
internal
static
var
motionAddedAnimations
:
[(
CALayer
,
String
,
CAAnimation
)]?
=
{
let
swizzling
:
(
AnyClass
,
Selector
,
Selector
)
->
Void
=
{
forClass
,
originalSelector
,
swizzledSelector
in
if
let
originalMethod
=
class_getInstanceMethod
(
forClass
,
originalSelector
),
let
swizzledMethod
=
class_getInstanceMethod
(
forClass
,
swizzledSelector
)
{
...
...
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