Sha256: 71029d9e0a115817349aabe3c6f085ff6e48be75f4cdb84a6db912b59fd64cd1
Contents?: true
Size: 656 Bytes
Versions: 3
Compression:
Stored size: 656 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
3 entries across 3 versions & 1 rubygems