spinning PieChart
in
Programming Questions
•
9 months ago
Hi everyone!
I am using the code below to generate a PieChart, the problem is that I cannot use the noLoop() method because I have various elements in my sketch that are continuously updating, but removing noLoop causes the PieChart to start spinning without any apparent reason. Could someone help me in solving this problem?
Thank you so much.
float diameter; int[] angles = { 30, 10, 45, 35, 60, 38, 75, 67 }; float lastAngle = 0; void setup() { size(640, 360); background(100); noStroke(); diameter = min(width, height) * 0.75; noLoop(); // Run once and stop } void draw() { for (int i = 0; i < angles.length; i++) { fill(angles[i] * 3.0); arc(width/2, height/2, diameter, diameter, lastAngle, lastAngle+radians(angles[i])); lastAngle += radians(angles[i]); } }
1