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 - 動畫CPScatterPlot
- 3. 在Core Plot中畫一條垂直線?
- 4. 如何在使用Core Plot創建的條形圖中獲取每個條CGMutablePathRef?
- 5. 定製Core-Plot Iphone圖形
- 6. 如何在Core Plot中繪製條形圖,並在這些條形圖的X軸下延伸?
- 7. 更改Core Plot餅圖標題的外觀
- 8. 如何在Core Plot中複製以下圖形?
- 9. 如何使用Core Plot在圖表中繪製水平條?
- 10. Core-Plot Mac:在圖中的鼠標懸停點顯示標籤
- 11. 無法在Matplotlib中顯示條形圖的動畫
- 12. 如何在HTML5畫布中顯示多個外部svg圖形
- 13. 如何在iPad中顯示條形圖?
- 14. 我想使用Android Plot在Android Activity中顯示圖形,如何在圖形中顯示我的數據?
- 15. Core-Plot正確格式化圖形
- 16. 如何在iphone中使用Core Plot框架繪製簡單的線條圖和條形圖?
- 17. 如何在畫面中做動畫?創建動態條形圖
- 18. 無法在Core Plot Bar Chart中實現更改條形顏色
- 19. core-plot條形圖綁定到一個NSArrayController
- 20. 畫布條形圖動畫
- 21. 如何顯示在Reportview條形圖
- 22. 如何在iPhone上顯示條形圖?
- 23. core-plot iOS:如何讓圖形從底部開始一定量?
- 24. 堆積條形圖:改變整個條形的外觀?
- 25. 如何向右移動標籤Core Plot?
- 26. core-plot,如何使軸標題浮動
- 27. Core-Plot:如何更改餅圖
- 28. g.raphael:如何動畫條形圖高度?
- 29. 如何動畫水平D3條形圖?
- 30. 在core-plot中使用加速計數據繪製圖形
不編譯 – Luda 2014-08-24 10:33:52