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
56ecc29f
Unverified
Commit
56ecc29f
authored
Feb 27, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: remove old file PulseMotion
parent
8bbdbbad
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6 additions
and
210 deletions
+6
-210
Sources/iOS/Button.swift
+1
-1
Sources/iOS/CollectionReusableView.swift
+1
-1
Sources/iOS/CollectionViewCell.swift
+1
-1
Sources/iOS/PulseAnimation.swift
+1
-1
Sources/iOS/PulseMotion.swift
+0
-204
Sources/iOS/PulseView.swift
+1
-1
Sources/iOS/TableViewCell.swift
+1
-1
No files found.
Sources/iOS/Button.swift
View file @
56ecc29f
...
@@ -43,7 +43,7 @@ open class Button: UIButton, Pulseable, PulseableLayer {
...
@@ -43,7 +43,7 @@ open class Button: UIButton, Pulseable, PulseableLayer {
internal
var
pulse
:
Pulse
!
internal
var
pulse
:
Pulse
!
/// A reference to the pulse layer.
/// A reference to the pulse layer.
public
var
pulseLayer
:
CALayer
?
{
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseLayer
return
pulse
.
pulseLayer
}
}
...
...
Sources/iOS/CollectionReusableView.swift
View file @
56ecc29f
...
@@ -44,7 +44,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
...
@@ -44,7 +44,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
internal
var
pulse
:
Pulse
!
internal
var
pulse
:
Pulse
!
/// A reference to the pulse layer.
/// A reference to the pulse layer.
public
var
pulseLayer
:
CALayer
?
{
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseLayer
return
pulse
.
pulseLayer
}
}
...
...
Sources/iOS/CollectionViewCell.swift
View file @
56ecc29f
...
@@ -44,7 +44,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
...
@@ -44,7 +44,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
internal
var
pulse
:
Pulse
!
internal
var
pulse
:
Pulse
!
/// A reference to the pulse layer.
/// A reference to the pulse layer.
public
var
pulseLayer
:
CALayer
?
{
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseLayer
return
pulse
.
pulseLayer
}
}
...
...
Sources/iOS/PulseAnimation.swift
View file @
56ecc29f
...
@@ -53,7 +53,7 @@ public protocol Pulseable {
...
@@ -53,7 +53,7 @@ public protocol Pulseable {
var
pulseOpacity
:
CGFloat
{
get
set
}
var
pulseOpacity
:
CGFloat
{
get
set
}
}
}
public
protocol
PulseableLayer
{
internal
protocol
PulseableLayer
{
/// A reference to the pulse layer.
/// A reference to the pulse layer.
var
pulseLayer
:
CALayer
?
{
get
}
var
pulseLayer
:
CALayer
?
{
get
}
}
}
...
...
Sources/iOS/PulseMotion.swift
deleted
100644 → 0
View file @
8bbdbbad
/*
* Copyright (C) 2015 - 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
@objc(PulseAnimation)
public
enum
PulseAnimation
:
Int
{
case
none
case
center
case
centerWithBacking
case
centerRadialBeyondBounds
case
radialBeyondBounds
case
backing
case
tap
case
point
case
pointWithBacking
}
internal
protocol
Pulseable
{
/// A reference to the PulseAnimation.
var
pulseAnimation
:
PulseAnimation
{
get
set
}
/// A UIColor.
var
pulseColor
:
UIColor
{
get
set
}
/// The opcaity value for the pulse animation.
var
pulseOpacity
:
CGFloat
{
get
set
}
/// The PulseMotion instance.
var
pulse
:
PulseMotion
!
{
get
set
}
}
public
struct
PulseMotion
{
/// A UIView that is Pulseable.
internal
weak
var
pulseView
:
UIView
?
/// The layer the pulse layers are added to.
internal
weak
var
pulseLayer
:
CALayer
?
/// Pulse layers.
internal
var
layers
=
[
CAShapeLayer
]()
/// A reference to the PulseAnimation.
public
var
animation
=
PulseAnimation
.
pointWithBacking
/// A UIColor.
public
var
color
=
Color
.
grey
.
base
/// The opcaity value for the pulse animation.
public
var
opacity
:
CGFloat
=
0.18
/**
An initializer that takes a given view and pulse layer.
- Parameter pulseView: An optional UIView.
- Parameter pulseLayer: An optional CALayer.
*/
internal
init
(
pulseView
:
UIView
?,
pulseLayer
:
CALayer
?)
{
self
.
pulseView
=
pulseView
self
.
pulseLayer
=
pulseLayer
}
}
extension
PulseMotion
{
/**
Triggers the expanding animation.
- Parameter point: A point to pulse from.
*/
public
mutating
func
expand
(
point
:
CGPoint
)
{
guard
let
view
=
pulseView
else
{
return
}
guard
let
layer
=
pulseLayer
else
{
return
}
guard
.
none
!=
animation
else
{
return
}
let
bLayer
=
CAShapeLayer
()
let
pLayer
=
CAShapeLayer
()
bLayer
.
addSublayer
(
pLayer
)
layer
.
addSublayer
(
bLayer
)
bLayer
.
zPosition
=
0
pLayer
.
zPosition
=
0
layers
.
insert
(
bLayer
,
at
:
0
)
layer
.
masksToBounds
=
!
(
.
centerRadialBeyondBounds
==
animation
||
.
radialBeyondBounds
==
animation
)
let
w
=
view
.
bounds
.
width
let
h
=
view
.
bounds
.
height
Motion
.
disable
(
animations
:
{
[
n
=
.
center
==
animation
?
w
<
h
?
w
:
h
:
w
<
h
?
h
:
w
,
bounds
=
layer
.
bounds
,
animation
=
animation
,
color
=
color
,
opacity
=
opacity
]
in
bLayer
.
frame
=
bounds
pLayer
.
bounds
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
n
,
height
:
n
)
switch
animation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
:
pLayer
.
position
=
CGPoint
(
x
:
w
/
2
,
y
:
h
/
2
)
default
:
pLayer
.
position
=
point
}
pLayer
.
cornerRadius
=
n
/
2
pLayer
.
backgroundColor
=
color
.
withAlphaComponent
(
opacity
)
.
cgColor
pLayer
.
transform
=
CATransform3DMakeAffineTransform
(
CGAffineTransform
(
scaleX
:
0
,
y
:
0
))
})
bLayer
.
setValue
(
false
,
forKey
:
"animated"
)
let
duration
:
TimeInterval
=
.
tap
==
animation
?
0
:
.
center
==
animation
?
0.16125
:
0.325
switch
animation
{
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
,
.
tap
:
bLayer
.
motion
(
.
duration
(
duration
),
.
backgroundColor
(
color
.
withAlphaComponent
(
opacity
/
2
)))
default
:
break
}
switch
animation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
pLayer
.
motion
(
.
duration
(
duration
),
.
scale
(
1
))
default
:
break
}
Motion
.
delay
(
duration
)
{
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
}
}
}
extension
PulseMotion
{
/// Triggers the contracting animation.
public
mutating
func
contract
()
{
guard
let
bLayer
=
layers
.
popLast
()
else
{
return
}
guard
let
animated
=
bLayer
.
value
(
forKey
:
"animated"
)
as?
Bool
else
{
return
}
Motion
.
delay
(
animated
?
0
:
0.15
)
{
[
animation
=
animation
,
color
=
color
]
in
guard
let
pLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
else
{
return
}
let
duration
:
TimeInterval
=
0.325
switch
animation
{
case
.
centerWithBacking
,
.
backing
,
.
pointWithBacking
,
.
tap
:
bLayer
.
motion
(
.
duration
(
duration
),
.
backgroundColor
(
color
.
withAlphaComponent
(
0
)))
default
:
break
}
switch
animation
{
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
radialBeyondBounds
,
.
point
,
.
pointWithBacking
:
pLayer
.
motion
(
.
duration
(
duration
),
.
scale
(
.
center
==
animation
?
1
:
1.325
),
.
backgroundColor
(
color
.
withAlphaComponent
(
0
)))
default
:
break
}
Motion
.
delay
(
duration
)
{
pLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
}
}
}
}
Sources/iOS/PulseView.swift
View file @
56ecc29f
...
@@ -35,7 +35,7 @@ open class PulseView: View, Pulseable, PulseableLayer {
...
@@ -35,7 +35,7 @@ open class PulseView: View, Pulseable, PulseableLayer {
internal
var
pulse
:
Pulse
!
internal
var
pulse
:
Pulse
!
/// A reference to the pulse layer.
/// A reference to the pulse layer.
public
var
pulseLayer
:
CALayer
?
{
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseLayer
return
pulse
.
pulseLayer
}
}
...
...
Sources/iOS/TableViewCell.swift
View file @
56ecc29f
...
@@ -43,7 +43,7 @@ open class TableViewCell: UITableViewCell, Pulseable, PulseableLayer {
...
@@ -43,7 +43,7 @@ open class TableViewCell: UITableViewCell, Pulseable, PulseableLayer {
internal
var
pulse
:
Pulse
!
internal
var
pulse
:
Pulse
!
/// A reference to the pulse layer.
/// A reference to the pulse layer.
public
var
pulseLayer
:
CALayer
?
{
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseLayer
return
pulse
.
pulseLayer
}
}
...
...
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