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
ca800bda
Unverified
Commit
ca800bda
authored
Jun 30, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated README to test new gif animations
parent
80ffe511
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
26 deletions
+27
-26
README.md
+24
-22
Sources/Extensions/Motion+CALayer.swift
+3
-4
No files found.
README.md
View file @
ca800bda
...
...
@@ -31,88 +31,90 @@ Motion offers a clean API to add animations to your views and layers. Simply pas
<table>
<thead>
<tr>
<th>
Animation
</th>
<th>
Example
</th>
<th>
Property
</th>
<th>
Swift
</th>
</tr>
</thead>
<tbody>
<tr>
<td
width=
"
4
0%"
>
<td
width=
"
3
0%"
>
<img
src=
"http://www.cosmicmind.com/motion/background_color.gif"
/>
</td>
<td
width=
"30%"
>
Border Color
</td>
<td
width=
"30%"
>
```swift
view.animate(.background(color: .cyan))
```
<td
width=
"40%"
>
<pre><code>
view.animate(.background(color: .cyan))
</code></pre>
</td>
</tr>
<tr>
<td
width=
"
4
0%"
style=
"background-color: #ffffff"
>
<td
width=
"
3
0%"
style=
"background-color: #ffffff"
>
<img
src=
"http://www.cosmicmind.com/motion/border_color.gif"
/>
</td>
<td
width=
"30%"
>
Border Color & Border Width
</td>
<td
width=
"30%"
>
```swift
view.animate(.border(color: .cyan), .border(width: 20))
```
</td>
<td
width=
"40%"
>
<pre><code>
view.animate(.border(color: .cyan), .border(width: 20))
</code></pre>
</td>
</tr>
<tr
style=
"background-color: #fff"
>
<td
width=
"
4
0%"
>
<td
width=
"
3
0%"
>
<img
src=
"http://www.cosmicmind.com/motion/corner_radius.gif"
/>
</td>
<td
width=
"30%"
>
Border Color & Border Width
</td>
<td
width=
"
3
0%"
>
```swift
<td
width=
"
4
0%"
>
```swift
view.animate(.border(color: .cyan), .border(width: 20))
```
</td>
</tr>
<tr
style=
"background-color: #fff"
>
<td
width=
"
4
0%"
>
<td
width=
"
3
0%"
>
<img
src=
"http://www.cosmicmind.com/motion/depth.gif"
/>
</td>
<td
width=
"30%"
>
Border Color & Border Width
</td>
<td
width=
"
3
0%"
>
```swift
<td
width=
"
4
0%"
>
```swift
view.animate(.border(color: .cyan), .border(width: 20))
```
</td>
</tr>
<tr
style=
"background-color: #fff"
>
<td
width=
"
4
0%"
>
<td
width=
"
3
0%"
>
<img
src=
"http://www.cosmicmind.com/motion/fade.gif"
/>
</td>
<td
width=
"30%"
>
Border Color & Border Width
</td>
<td
width=
"
3
0%"
>
```swift
<td
width=
"
4
0%"
>
```swift
view.animate(.border(color: .cyan), .border(width: 20))
```
</td>
</tr>
<tr
style=
"background-color: #fff"
>
<td
width=
"
4
0%"
>
<td
width=
"
3
0%"
>
<img
src=
"http://www.cosmicmind.com/motion/position.gif"
/>
</td>
<td
width=
"30%"
>
Border Color & Border Width
</td>
<td
width=
"
3
0%"
>
```swift
<td
width=
"
4
0%"
>
```swift
view.animate(.border(color: .cyan), .border(width: 20))
```
</td>
</tr>
<tr
style=
"background-color: #fff"
>
<td
width=
"
4
0%"
>
<td
width=
"
3
0%"
>
<img
src=
"http://www.cosmicmind.com/motion/rotate.gif"
/>
</td>
<td
width=
"30%"
>
Border Color & Border Width
</td>
<td
width=
"
3
0%"
>
```swift
<td
width=
"
4
0%"
>
```swift
view.animate(.border(color: .cyan), .border(width: 20))
```
</td>
</tr>
<tr
style=
"background-color: #fff"
>
<td
width=
"
4
0%"
>
<td
width=
"
3
0%"
>
<img
src=
"http://www.cosmicmind.com/motion/scale.gif"
/>
</td>
<td
width=
"30%"
>
Border Color & Border Width
</td>
<td
width=
"
3
0%"
>
```swift
<td
width=
"
4
0%"
>
```swift
view.animate(.border(color: .cyan), .border(width: 20))
```
</td>
...
...
Sources/Extensions/Motion+CALayer.swift
View file @
ca800bda
...
...
@@ -130,17 +130,17 @@ public extension CALayer {
- Parameter completion: An optional completion block.
*/
func
animate
(
_
animations
:
[
MotionAnimation
],
completion
:
(()
->
Void
)?
=
nil
)
{
animate
(
animations
:
animations
,
completion
:
completion
)
startAnimations
(
animations
,
completion
:
completion
)
}
}
fileprivate
extension
CALayer
{
/**
A function that executes an Array of MotionAnimation values.
- Parameter animations: An Array of MotionAnimations.
- Parameter
_
animations: An Array of MotionAnimations.
- Parameter completion: An optional completion block.
*/
func
animate
(
animations
:
[
MotionAnimation
],
completion
:
(()
->
Void
)?
=
nil
)
{
func
startAnimations
(
_
animations
:
[
MotionAnimation
],
completion
:
(()
->
Void
)?
=
nil
)
{
let
targetState
=
MotionAnimationState
(
animations
:
animations
)
Motion
.
delay
(
targetState
.
delay
)
{
[
weak
self
,
...
...
@@ -274,7 +274,6 @@ fileprivate extension CALayer {
s
.
animate
(
g
)
if
let
v
=
targetState
.
completion
{
print
(
duration
)
Motion
.
delay
(
duration
,
execute
:
v
)
}
...
...
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