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 12:54:27 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9f9058d718157fe15ed0882d48fbdc0052d370d9
9f9058d7
1 parent
98e436de
Makes animation optional on Radar chart
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
PNChart/PNRadarChart.m
PNChart/PNRadarChart.m
View file @
9f9058d
...
...
@@ -203,25 +203,7 @@
_chartPlot
.
path
=
plotline
.
CGPath
;
CABasicAnimation
*
animateScale
=
[
CABasicAnimation
animationWithKeyPath
:
@"transform.scale"
];
animateScale
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
f
];
animateScale
.
toValue
=
[
NSNumber
numberWithFloat
:
1
.
0
f
];
CABasicAnimation
*
animateMove
=
[
CABasicAnimation
animationWithKeyPath
:
@"position"
];
animateMove
.
fromValue
=
[
NSValue
valueWithCGPoint
:
CGPointMake
(
_centerX
,
_centerY
)];
animateMove
.
toValue
=
[
NSValue
valueWithCGPoint
:
CGPointMake
(
0
,
0
)];
CABasicAnimation
*
animateAlpha
=
[
CABasicAnimation
animationWithKeyPath
:
@"opacity"
];
animateAlpha
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
f
];
CAAnimationGroup
*
aniGroup
=
[
CAAnimationGroup
animation
];
aniGroup
.
duration
=
1
.
f
;
aniGroup
.
repeatCount
=
1
;
aniGroup
.
animations
=
[
NSArray
arrayWithObjects
:
animateScale
,
animateMove
,
animateAlpha
,
nil
];
aniGroup
.
removedOnCompletion
=
YES
;
[
_chartPlot
addAnimation
:
aniGroup
forKey
:
nil
];
[
self
addAnimationIfNeeded
];
[
self
showGraduation
];
}
...
...
@@ -363,6 +345,28 @@
return
ceil
(
max
);
}
-
(
void
)
addAnimationIfNeeded
{
if
(
self
.
displayAnimated
)
{
CABasicAnimation
*
animateScale
=
[
CABasicAnimation
animationWithKeyPath
:
@"transform.scale"
];
animateScale
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
f
];
animateScale
.
toValue
=
[
NSNumber
numberWithFloat
:
1
.
0
f
];
CABasicAnimation
*
animateMove
=
[
CABasicAnimation
animationWithKeyPath
:
@"position"
];
animateMove
.
fromValue
=
[
NSValue
valueWithCGPoint
:
CGPointMake
(
_centerX
,
_centerY
)];
animateMove
.
toValue
=
[
NSValue
valueWithCGPoint
:
CGPointMake
(
0
,
0
)];
CABasicAnimation
*
animateAlpha
=
[
CABasicAnimation
animationWithKeyPath
:
@"opacity"
];
animateAlpha
.
fromValue
=
[
NSNumber
numberWithFloat
:
0
.
f
];
CAAnimationGroup
*
aniGroup
=
[
CAAnimationGroup
animation
];
aniGroup
.
duration
=
1
.
f
;
aniGroup
.
repeatCount
=
1
;
aniGroup
.
animations
=
[
NSArray
arrayWithObjects
:
animateScale
,
animateMove
,
animateAlpha
,
nil
];
aniGroup
.
removedOnCompletion
=
YES
;
[
_chartPlot
addAnimation
:
aniGroup
forKey
:
nil
];
}
}
@end
...
...
Please
register
or
login
to post a comment