Sha256: f45c3e85f3cfdb9a02999f45a8a6fe3fa723225bdfff8955a1eadf7df82aaa18
Contents?: true
Size: 507 Bytes
Versions: 10
Compression:
Stored size: 507 Bytes
Contents
# Modulo. # # The modulo operator (%) returns the remainder of a number # divided by another. As in this example, it is often used # to keep numerical values within a set range. def setup size 200, 200 @c = 0.0 @num = 20 fill 255 frame_rate 30 end def draw background 0 @c += 0.1 (1...(height/@num)).each { |i| x = (@c %i ) * i * i stroke 102 line 0, i*@num, x, i*@num no_stroke rect x, i*@num-@num/2, 8, @num } end
Version data entries
10 entries across 10 versions & 1 rubygems