5
A
回答
1
11
这是我做过什么:
在我的viewDidLoad控制器的方法,我创建了CPTXYGraph:
graph = [[CPTXYGraph alloc] initWithFrame:self.view.bounds];
我添加动画空图:
CAKeyframeAnimation *scale = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
然后在animationDidStop委托的方法我增加了绘图数据和动画的图形:
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform.scale.y"]; [anim setDuration:2.0f]; anim.toValue = [NSNumber numberWithFloat:1.0f]; anim.fromValue = [NSNumber numberWithFloat:0.0f]; anim.removedOnCompletion = NO; anim.delegate = self; anim.fillMode = kCAFillModeForwards; gPlot.anchorPoint = CGPointMake(0.0, 0.0); [gPlot addAnimation:anim forKey:@"grow"]; [graph addPlot:gPlot ];// IMPORTANT here I added the plot data to the graph :) .
3
您CPTBarPlot添加动画如下:
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
[animation setDuration:1];
CATransform3D transform = CATransform3DMakeScale(1, 0.0001, 1);
// offsetY=[PlotDisplayAreaUnderXAxisHeight]-[PlotDisplayAreaHeight]/2
transform = CATransform3DConcat(transform, CATransform3DMakeTranslation(0, offsetY, 0));
animation.fromValue = [NSValue valueWithCATransform3D:transform];
animation.toValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
[barPlot addAnimation:animation forKey:@"barGrowth"];
2
感谢米歇尔为你的伟大回答。
我已经从她的答案上传了一个Github的例子给那些想要下载演示并立即开始工作的人!
https://github.com/mayuur/CoreplotAnimation
享受编码!
0
添加不透明度动画这样的...
CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
fadeInAnimation.duration = 1.0f;
fadeInAnimation.removedOnCompletion = NO;
fadeInAnimation.fillMode = kCAFillModeForwards;
fadeInAnimation.toValue = [NSNumber numberWithFloat:1.0];
[xSquaredPlot addAnimation:fadeInAnimation forKey:@"animateOpacity"];
相关问题
- 1. 如何移动Core Plot图形
- 2. 在Core Plot中画一条垂直线?
- 3. 如何在Core Plot中绘制条形图,并在这些条形图的X轴下延伸?
- 4. 更改Core Plot饼图标题的外观
- 5. 无法在Matplotlib中显示条形图的动画
- 6. 如何在Core Plot中复制以下图形?
- 7. Core-Plot Mac:在图中的鼠标悬停点显示标签
- 8. 如何使用Core Plot在图表中绘制水平条?
- 9. 我想使用Android Plot在Android Activity中显示图形,如何在图形中显示我的数据?
- 10. 如何在画面中做动画?创建动态条形图
- 11. 如何在iphone中使用Core Plot框架绘制简单的线条图和条形图?
- 12. core-plot条形图绑定到一个NSArrayController
- 13. Core-Plot不显示轴标题
- 14. 如何在iPhone上显示条形图?
- 15. 如何动画水平D3条形图?
- 16. 如何向右移动标签Core Plot?
- 17. core-plot,如何使轴标题浮动
- 18. Core-Plot:如何更改饼图
- 19. 在core-plot中使用加速计数据绘制图形
- 20. 如何显示由Core-plot创建的堆叠条中每个图的尖端值?
- 21. 如何显示条形图中每个条的条值?
- 22. 在core-plot中约束滚动
- 23. 可能移动Core Plot饼图标签?
- 24. 如何提高Core-Plot
- 25. 图形FillPolygon外观?
- 26. 在Javascript中动画div的外观
- 27. 如何在iPhone SDK的Core Plot中添加图例?
- 28. Core Plot势头滚动
- 29. 如何修改条形图在R条形图上的显示方式
- 30. 如何动画悬停在图像外观上?
不编译 – Luda 2014-08-24 10:33:52