【问题标题】:Animating a Core Plot ScatterGraph动画核心绘图 ScatterGraph
【发布时间】:2011-09-21 11:06:38
【问题描述】:

我的 iPad 应用程序使用 Core Plot 有一个散点图,一切运行良好。我想要做的是为线条的绘制设置动画,以便看起来图形上的每个点到点都被绘制在用户面前。我不想淡入淡出,因为我已经开始工作了。

我看到下面提出的问题非常相似,但我不完全理解答案。 Core-Plot - animating a CPScatterPlot

请记住,我是 Core Plot 的新手,并且只使用了一天左右。

谢谢

【问题讨论】:

  • 您是如何设法淡化该行的单个“块”的?

标签: ios animation core-animation core-plot scatter-plot


【解决方案1】:
self.plot.anchorPoint = CGPointMake(0.0, 0.0); // Moved anchor point, 

CABasicAnimation *scaling = [CABasicAnimation 
                                 animationWithKeyPath:@"transform.scale.y"]; // s
scaling.fromValue = [NSNumber numberWithFloat:0.0]; 
scaling.toValue = [NSNumber numberWithFloat:1.0]; 
scaling.duration = 0.1f; // Duration 
scaling.removedOnCompletion = NO; 
scaling.fillMode = kCAFillModeForwards; 
[self.plot addAnimation:scaling forKey:@"scaling"];

【讨论】:

  • 使用该持续时间值,动画可能会很快看到。如果是这种情况,请增加值。
【解决方案2】:

查看 Core Plot 附带的 Plot Gallery 示例应用程序中的“实时演示”图。它使用计时器一次将一个点添加到散点图中。代码可以在here找到。

-newData: 方法在绘图中添加一个点并更新绘图范围,以便新点可见。对-insertDataAtIndex:numberOfRecords: 的调用会导致绘图检索新数据点并自动重绘。

【讨论】:

  • 由于某种原因似乎无法编译
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-26
  • 1970-01-01
  • 1970-01-01
  • 2010-10-21
相关资源
最近更新 更多