I am trying to scale in a core plot scatter plot (like a line graph) so that it scales in to view. CorePlot uses a normal CALayer to implement its plot.
I am using Core animation as follows to achieve this:
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"affineTransform"];
animation.duration = 10;
animation.removedOnCompletion = YES;
animation.fillMode = kCAFillModeForwards;
CGAffineTransform start = CGAffineTransformMakeScale(1, 0.1);
CGAffineTransform end = CGAffineTransformMakeScale(1, 1);
animation.fromValue = [NSValue valueWithCGAffineTransform:start];
animation.toValue = [NSValue valueWithCGAffineTransform:end];
[plot addAnimation:animation forKey:@"animation"];
The problem is this doesn't seem to work. This is the first time I am using core animation so I am thinking I am just doing something wrong?
EDIT OK so I found the issue I was using the wrong keypath.
I can get it to animate now but it looks wierd:
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale.y"];
...
animation.fromValue = [NSNumber numberWithFloat:0.1];
animation.toValue = [NSNumber numberWithFloat:1];
What I want to do is have the animation 'scale upwards' so it kind of stretches in to place. Right now it kind of grows out from the centre which is not what I want. Any idea how to achieve that?