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
80a0075e
Commit
80a0075e
authored
Oct 03, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated MaterialPulseView and MaterialButton pulse animation
parent
609842a7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
16 deletions
+17
-16
Source/MaterialButton.swift
+4
-8
Source/MaterialLayer.swift
+9
-0
Source/MaterialPulseView.swift
+4
-8
No files found.
Source/MaterialButton.swift
View file @
80a0075e
...
@@ -363,20 +363,16 @@ public class MaterialButton : UIButton {
...
@@ -363,20 +363,16 @@ public class MaterialButton : UIButton {
if
true
==
layer
.
containsPoint
(
point
)
{
if
true
==
layer
.
containsPoint
(
point
)
{
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
f
:
CGFloat
=
3
let
f
:
CGFloat
=
3
var
v
:
CGFloat
=
s
/
f
let
v
:
CGFloat
=
s
/
f
let
d
:
CGFloat
=
2
*
f
MaterialAnimation
.
animationDisabled
({
MaterialAnimation
.
animationDisabled
({
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
cornerRadius
=
s
/
6
self
.
pulseLayer
.
cornerRadius
=
s
/
d
})
})
v
=
2
*
f
MaterialAnimation
.
animationWithDuration
(
0.4
,
animations
:
{
self
.
pulseLayer
.
transform
=
CATransform3DMakeScale
(
v
,
v
,
v
)
})
MaterialAnimation
.
animationWithDuration
(
0.25
,
animations
:
{
MaterialAnimation
.
animationWithDuration
(
0.25
,
animations
:
{
self
.
pulseLayer
.
transform
=
CATransform3DMakeScale
(
d
,
d
,
d
)
self
.
layer
.
transform
=
CATransform3DMakeScale
(
1.05
,
1.05
,
1.05
)
self
.
layer
.
transform
=
CATransform3DMakeScale
(
1.05
,
1.05
,
1.05
)
})
})
}
}
...
...
Source/MaterialLayer.swift
View file @
80a0075e
...
@@ -20,14 +20,23 @@ import UIKit
...
@@ -20,14 +20,23 @@ import UIKit
public
class
MaterialLayer
:
CAShapeLayer
{
public
class
MaterialLayer
:
CAShapeLayer
{
/**
:name: init
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
super
.
init
(
coder
:
aDecoder
)
}
}
/**
:name: init
*/
public
override
init
(
layer
:
AnyObject
)
{
public
override
init
(
layer
:
AnyObject
)
{
super
.
init
(
layer
:
layer
)
super
.
init
(
layer
:
layer
)
}
}
/**
:name: init
*/
public
override
init
()
{
public
override
init
()
{
super
.
init
()
super
.
init
()
}
}
...
...
Source/MaterialPulseView.swift
View file @
80a0075e
...
@@ -58,20 +58,16 @@ public class MaterialPulseView : MaterialView {
...
@@ -58,20 +58,16 @@ public class MaterialPulseView : MaterialView {
if
true
==
layer
.
containsPoint
(
point
)
{
if
true
==
layer
.
containsPoint
(
point
)
{
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
f
:
CGFloat
=
3
let
f
:
CGFloat
=
3
var
v
:
CGFloat
=
s
/
f
let
v
:
CGFloat
=
s
/
f
let
d
:
CGFloat
=
2
*
f
MaterialAnimation
.
animationDisabled
({
MaterialAnimation
.
animationDisabled
({
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
cornerRadius
=
s
/
6
self
.
pulseLayer
.
cornerRadius
=
s
/
d
})
})
v
=
2
*
f
MaterialAnimation
.
animationWithDuration
(
0.4
,
animations
:
{
self
.
pulseLayer
.
transform
=
CATransform3DMakeScale
(
v
,
v
,
v
)
})
MaterialAnimation
.
animationWithDuration
(
0.25
,
animations
:
{
MaterialAnimation
.
animationWithDuration
(
0.25
,
animations
:
{
self
.
pulseLayer
.
transform
=
CATransform3DMakeScale
(
d
,
d
,
d
)
self
.
layer
.
transform
=
CATransform3DMakeScale
(
1.05
,
1.05
,
1.05
)
self
.
layer
.
transform
=
CATransform3DMakeScale
(
1.05
,
1.05
,
1.05
)
})
})
}
}
...
...
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