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
53088a53
Unverified
Commit
53088a53
authored
Jun 06, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rework of Motion+CG
parent
1dfc3fb8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
Sources/Extensions/Motion+CG.swift
+0
-0
Sources/Extensions/Motion+UIView.swift
+4
-6
No files found.
Sources/Extensions/Motion+CG.swift
View file @
53088a53
This diff is collapsed.
Click to expand it.
Sources/Extensions/Motion+UIView.swift
View file @
53088a53
...
...
@@ -30,24 +30,22 @@ import UIKit
internal
extension
UIView
{
func
optimizedDuration
(
fromPosition
:
CGPoint
,
toPosition
:
CGPoint
?,
size
:
CGSize
?,
transform
:
CATransform3D
?)
->
TimeInterval
{
let
fromPos
=
fromPosition
let
toPos
=
toPosition
??
fromPos
let
toPos
=
toPosition
??
fromPosition
let
fromSize
=
(
layer
.
presentation
()
??
layer
)
.
bounds
.
size
let
toSize
=
size
??
fromSize
let
fromTransform
=
(
layer
.
presentation
()
??
layer
)
.
transform
let
toTransform
=
transform
??
fromTransform
let
realFromPos
=
CGPoint
.
zero
.
transform
(
fromTransform
)
+
fromPos
let
realFromPos
=
CGPoint
.
zero
.
transform
(
fromTransform
)
+
fromPos
ition
let
realToPos
=
CGPoint
.
zero
.
transform
(
toTransform
)
+
toPos
let
realFromSize
=
fromSize
.
transform
(
fromTransform
)
let
realToSize
=
toSize
.
transform
(
toTransform
)
let
movePoints
=
(
realFromPos
.
distance
(
realToPos
)
+
realFromSize
.
point
.
distance
(
realToSize
.
point
)
)
let
movePoints
=
realFromPos
.
distance
(
realToPos
)
+
realFromSize
.
bottomRight
.
distance
(
realToSize
.
bottomRight
)
// duration is 0.2 @ 0 to 0.375 @ 500
let
duration
=
0.208
+
Double
(
movePoints
.
clamp
(
0
,
500
))
/
3000
return
duration
return
0.208
+
Double
(
movePoints
.
clamp
(
0
,
500
))
/
3000
}
}
...
...
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