Sha256: d950f6c828bf3040b0cebc0d40c9483af8ff11f893585226ea46c5a1b61b195f
Contents?: true
Size: 658 Bytes
Versions: 7
Compression:
Stored size: 658 Bytes
Contents
# # Rotate Push Pop. # # The push and pop functions allow for more control over transformations. # The push function saves the current coordinate system to the stack # and pop restores the prior coordinate system. # attr_reader :offset, :a, :num def setup size(640, 360, P3D) no_stroke @offset = PI / 24.0 @num = 12 @a = 0 end def draw lights background(0, 0, 26) translate(width/2, height/2) (0 ... num).each do |i| gray = map(i, 0, num - 1, 0, 255) push_matrix fill(gray) rotate_y(a + offset*i) rotate_x(a/2 + offset*i) box(200) pop_matrix end @a += 0.01 end
Version data entries
7 entries across 7 versions & 1 rubygems