【问题标题】:Why does the object appear before animation为什么物体出现在动画之前
【发布时间】:2015-04-30 05:23:38
【问题描述】:

我在我的xcode 项目中实现了corePlot。我使用饼图,并尝试像这样对其进行动画处理:

[CPTAnimation animate:pieChart property:@"endAngle" from:pieChart.startAngle + M_PI * 2 to:pieChart.startAngle  duration:2.0];

它的动画效果很好,但问题是,一旦应该显示图表,(在动画之前)图表会显示片刻,然后消失并开始动画。

我怎样才能让它在不提前出现的情况下启动动画?

更新

这里是完整的代码:

CPTGraph *graph = self.hostView.hostedGraph;
self.pieChart = [[CPTPieChart alloc] init];
self.pieChart.dataSource = self;
self.pieChart.delegate = self;
self.pieChart.pieRadius = (self.hostView.bounds.size.height * 0.7) / 2;
self.pieChart.identifier = graph.title;
self.pieChart.endAngle = self.pieChart.startAngle;
self.pieChart.pieInnerRadius = self.pieChart.pieRadius / 2;

【问题讨论】:

    标签: ios objective-c animation core-plot


    【解决方案1】:

    配置绘图时,将初始endAngle 设置为与startAngle 相同的值。默认的NAN 告诉绘图从startAngle 开始画一个完整的圆。

    【讨论】:

    • 对不起,打扰了! (我是objective-c和corePlot的初学者。)我做了以下pieChart.endAngle = pieChart.startAngle;我得到了同样的效果?
    • 查看 Plot Gallery 示例应用程序中的“甜甜圈图”演示。它使外环从垂直方向(开始和结束角度 == π/2)向外扩展,然后在延迟后对内圆的半径进行动画处理。即使删除动画,我也没有看到绘制完整环的初始闪光。
    • 只有在应用动画时才会闪烁。可能是我实现动画的方式不对?
    • 你需要从startAngle动画到新的结束值。
    猜你喜欢
    • 2011-12-24
    • 1970-01-01
    • 1970-01-01
    • 2020-05-09
    • 1970-01-01
    • 1970-01-01
    • 2019-04-24
    • 2018-04-25
    • 1970-01-01
    相关资源
    最近更新 更多