Sha256: 4e55d52d977bfdae937f4fc3169e1956c74e3190e0f719ebd09ed5b615bdd991
Contents?: true
Size: 559 Bytes
Versions: 2
Compression:
Stored size: 559 Bytes
Contents
# Pie Chart # By Ira Greenberg # # Uses the arc() function to generate a pie chart from the data # stored in an array. def setup size 640, 360 background 100 smooth(4) no_stroke diameter = min(width, height) * 0.75 angles = [30, 10, 45, 35 ,60, 38, 75, 67] last_angle = 0.0 angles.each do |angle| fill angle * 3.0 arc width/2, height/2, # center x, y diameter, diameter, # width, height last_angle, last_angle + angle.radians # angles from, to last_angle += angle.radians end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-processing-2.6.0 | samples/processing_app/basics/form/pie_chart.rb |
ruby-processing-2.5.1 | samples/processing_app/basics/form/pie_chart.rb |