Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
PNChart
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Emma Makinson
2015-12-18 16:34:10 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d1fd080c46726cb0b11b6ce7fe20fc391db489d6
d1fd080c
1 parent
a50bc0eb
Remove update animation on PNCircleChart
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
11 deletions
PNChart/PNCircleChart.m
PNChart/PNCircleChart.m
View file @
d1fd080
...
...
@@ -209,24 +209,35 @@ displayCountingLabel:(BOOL)displayCountingLabel
}
-
(
void
)
updateChartByCurrent
:
(
NSNumber
*
)
current
byTotal
:
(
NSNumber
*
)
total
{
// Add animation
CABasicAnimation
*
pathAnimation
=
[
CABasicAnimation
animationWithKeyPath
:
@"strokeEnd"
];
pathAnimation
.
duration
=
self
.
duration
;
pathAnimation
.
timingFunction
=
[
CAMediaTimingFunction
functionWithName
:
kCAMediaTimingFunctionEaseInEaseOut
];
pathAnimation
.
fromValue
=
@
([
_current
floatValue
]
/
[
_total
floatValue
]);
pathAnimation
.
toValue
=
@
([
current
floatValue
]
/
[
total
floatValue
]);
_circle
.
strokeEnd
=
[
current
floatValue
]
/
[
total
floatValue
];
double
totalPercentageValue
=
[
current
floatValue
]
/
([
total
floatValue
]
/
100
.
0
);
if
(
_strokeColorGradientStart
)
{
self
.
gradientMask
.
strokeEnd
=
_circle
.
strokeEnd
;
[
self
.
gradientMask
addAnimation
:
pathAnimation
forKey
:
@"strokeEndAnimation"
];
}
[
_circle
addAnimation
:
pathAnimation
forKey
:
@"strokeEndAnimation"
];
if
(
_displayCountingLabel
)
{
[
self
.
countingLabel
countFrom
:
fmin
([
_current
floatValue
],
[
_total
floatValue
])
to
:[
current
floatValue
]
/
([
total
floatValue
]
/
100
.
0
)
withDuration
:
self
.
duration
];
// Add animation
if
(
self
.
displayAnimated
)
{
CABasicAnimation
*
pathAnimation
=
[
CABasicAnimation
animationWithKeyPath
:
@"strokeEnd"
];
pathAnimation
.
duration
=
self
.
duration
;
pathAnimation
.
timingFunction
=
[
CAMediaTimingFunction
functionWithName
:
kCAMediaTimingFunctionEaseInEaseOut
];
pathAnimation
.
fromValue
=
@
([
_current
floatValue
]
/
[
_total
floatValue
]);
pathAnimation
.
toValue
=
@
([
current
floatValue
]
/
[
total
floatValue
]);
if
(
_strokeColorGradientStart
)
{
[
self
.
gradientMask
addAnimation
:
pathAnimation
forKey
:
@"strokeEndAnimation"
];
}
[
_circle
addAnimation
:
pathAnimation
forKey
:
@"strokeEndAnimation"
];
if
(
_displayCountingLabel
)
{
[
self
.
countingLabel
countFrom
:
fmin
([
_current
floatValue
],
[
_total
floatValue
])
to
:
totalPercentageValue
withDuration
:
self
.
duration
];
}
}
else
if
(
_displayCountingLabel
)
{
[
self
.
countingLabel
countFrom
:
totalPercentageValue
to
:
totalPercentageValue
withDuration
:
self
.
duration
];
}
_circle
.
strokeEnd
=
[
current
floatValue
]
/
[
total
floatValue
];
_current
=
current
;
_total
=
total
;
}
...
...
Please
register
or
login
to post a comment