While developing pie chart using core plot I added animation for that for given code
CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath:@"transform"];
CATransform3D transform = CATransform3DMakeRotation(DegreesToRadians(360), 0, 0, 1);
rotation.toValue = [NSValue valueWithCATransform3D:transform];
rotation.duration = 10.0f;
[pieChart addAnimation:rotation forKey:@"rotation"];
This code gives following error Semantic Issue:
Implicit declaration of function 'DegreesToRadians' is invalid in C99
What can I do for avoid this?
And also run time it gives following error:
Apple_o Linker id error "_DegreesToRadians", referenced from:
Thanks and Regards
Vijayakumar
iOS Developer at Rhytha
https://rhytha.com/
How to Convert Degrees to Radians? The value of 180° is equal to π radians. To convert any given angle from the measure of degrees to radians, the value has to be multiplied by π/180.
You should use radians when you are looking at objects moving in circular paths or parts of circular path. In particular, rotational motion equations are almost always expressed using radians. The initial parameters of a problem might be in degrees, but you should convert these angles to radians before using them.
Just define a macro like:
#define DEGREES_RADIANS(angle) ((angle) / 180.0 * M_PI)
And change your method like:
CATransform3D transform = CATransform3DMakeRotation(DEGREES_RADIANS(360), 0, 0, 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With