You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Select the artboard (The bug doesn't happen otherwise)
Run the code
Bug: One part of the pie chart is too big (the pink)
Code used
Pie chart
//The percentages you need to visualizevarpercentages=[30,60,10];functionsetup(){//Creates an 400x400 artboardcreateCanvas(400,400);//Remove BordersnoStroke();}functiondraw(){//Custom function defined underneathpieChart(300,percentages);}//We define a function called pieChart that asks//for diameter and percentagefunctionpieChart(diameter,data){//We keep trak of the last angle drawn. The initial value//defines where the pie chart stars. -HALF_PI it 12 on a clock.varlastAngle=-HALF_PI;//We run a loop that runs as many times as there//are elements in the percentages arrayfor(vari=0;i<data.length;i++){//Every time we run the loop we define a random rgb color//for each section of the piefill(random(255),random(255),random(255));//We draw an arc that is centered at the center of the artboard,//has the first parameter of pieChart as a diameter//and takes one of the values from percentage, divides it by 100//multiplies it by 360 (so we get the percentage in degrees)//and then converts it into radians for angle//The variabile lastAngle is used to make sure we have arcs that//start where the last arc ended.arc(width/2,height/2,diameter,diameter,lastAngle,lastAngle+radians((data[i]/100)*360));lastAngle+=radians((data[i]/100)*360);}}
The text was updated successfully, but these errors were encountered:
What a fantastic find, I've been wondering for weeks WHY one masks would not work and never realized that it was connected to the current selection. Thanks, this should be an easy fix!
Steps to reproduce the bug
Code used
Pie chart
The text was updated successfully, but these errors were encountered: