Sha256: d8fd27f4fe53a0627b42a7f120bbb518f8f4b4118298492db71b00afe3187d77
Contents?: true
Size: 671 Bytes
Versions: 10
Compression:
Stored size: 671 Bytes
Contents
# Increment Decrement. # # In Java and C ... # Writing "a++" is equivalent to "a = a + 1". # Writing "a--" is equivalent to "a = a - 1". # In Ruby there is += 1 and -= 1: # a += 1 is equal to a = a + 1 def setup size 640, 360 color_mode RGB, width @a = 0 @b = width @direction = false frame_rate 30 end def draw @a += 1 if @a > width @a = 0 @direction = !@direction end if @direction stroke @a else stroke width-@a end line @a, 0, @a, height/2 @b -= 1 @b = width if @b < 0 if @direction stroke width-@b else stroke @b end line @b, height/2+1, @b, height end
Version data entries
10 entries across 10 versions & 1 rubygems