require 'ruby-processing' class RotateRectangles < Processing::App include Math def radians(x) return x*(PI/180) end def setup color_mode HSB, 100 background 0 no_stroke end def draw translate width/2, height/2 rotate radians(45) 5.times do |i| i += 1 fill 30, i*20, 99 sz = 60 - i*10 rect 0, 0, sz, sz end end end RotateRectangles.new :title => "Rotate Rectangles", :width => 400, :height => 400