我该如何设置动画 [英] How do I Animate this

查看:93
本文介绍了我该如何设置动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的xcode项目中实现了corePlot。我有一个饼图,我正在尝试动画。这是我的代码:



I implemented corePlot in my xcode project. I have a pie chart that I'm trying to animate. Here is my code:

CPTGraph *graph = self.hostView.hostedGraph;

CPTPieChart *pieChart = [[CPTPieChart alloc] init];
pieChart.dataSource = self;
pieChart.delegate = self;
pieChart.pieRadius = (self.hostView.bounds.size.height * 0.7) / 2;
pieChart.startAngle = M_PI_4;
pieChart.sliceDirection = CPTPieDirectionClockwise;

[graph addPlot:pieChart];





这就是我的尝试:



This is what I tried:

[CPTAnimation animate:pieChart property:@"startAngle" from:pieChart.startAngle to:pieChart.endAngle duration:1.0];



没有没有达到预期的效果。图表会显示一秒钟然后消失。



我试图得到这个效果:http://jsfiddle.net/ozgr1wfx/

推荐答案

你还没有设置一个结束角度。 :-O



您的代码是否有效?是否正确设置和准备了委托和数据源协议?

您可以随时手动动画。设置一个帧速率为1/60秒的计时器并逐个绘制。
You havent set an end angle. :-O

Does your code work? Are delegate and data source protocols correctly set and prepared?
You can always animate "by hand". Setup a timer with a frame rate of 1/60 of a second and draw all piece by piece.


这篇关于我该如何设置动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆