Sha256: 9a930aaa4c8974f8ce7edf831592575d210bd2b5a434e8d050614d9e2e4ecacf
Contents?: true
Size: 709 Bytes
Versions: 10
Compression:
Stored size: 709 Bytes
Contents
# Move the mouse left and right to shift the balance. # The "mouseX" variable is used to control both the # size and color of the rectangles. def setup size 640, 360 color_mode RGB, 1.0 rect_mode CENTER no_stroke end def draw background 0 x_dist_blocks = width/2 block_size = map(mouse_x, 0, width, 10, x_dist_blocks - 10) left_color = -0.002 * mouse_x / 2 + 0.06 fill 0.0, left_color + 0.4, left_color + 0.6 rect(width/4, height / 2, block_size * 2, block_size * 2) block_size = x_dist_blocks - block_size right_color = 0.002 * mouse_x/2 + 0.06 fill(0.0, right_color + 0.2, right_color + 0.4) rect((width / 4) * 3, height / 2, block_size * 2, block_size * 2) end
Version data entries
10 entries across 10 versions & 1 rubygems