ios - Why is this not animating? -
i implemented coreplot in xcode project. have pie chart i'm trying animate. here code:
- (void)configurechart { cptgraph *graph = self.hostview.hostedgraph; cptpiechart *piechart = [[cptpiechart alloc] init]; piechart.datasource = self; piechart.delegate = self; piechart.pieradius = (self.hostview.bounds.size.height * 0.7) / 2; piechart.startangle = m_pi_4; piechart.slicedirection = cptpiedirectionclockwise; [graph addplot:piechart]; this tried:
cabasicanimation *rotation = [cabasicanimation animationwithkeypath:@"transform.rotation"]; rotation.removedoncompletion = yes; rotation.fromvalue = [nsnumber numberwithfloat:0.0f]; rotation.duration = 1.0f; rotation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout]; rotation.delegate = self; [piechart addanimation:rotation forkey:@"rotation"]; } when run app, doesn't animate. doing wrong, , how can fix it?
update 1
i tried following:
[cptanimation animate:piechart property:@"startangle" from:piechart.startangle to:piechart.endangle duration:1.0]; that didn't have desired effect. chart show second, disappear.
update 2
i'm trying effect: http://jsfiddle.net/ozgr1wfx/
i'm not sure i'm doing wrong.
don't animate layer transform. animate start angle instead. otherwise, labels , other annotations rotate plot.
from plot gallery example app:
[cptanimation animate:pieplot property:@"startangle" from:cptfloat(m_pi_2) to:cptfloat(m_pi_4) duration:0.25]; as noted in comments, angles given in radians (pi radians = 180 degrees).
Comments
Post a Comment