Sha256: 97a0e1d3bab58c2b99a50f0190b4dc0b6597e3cee06693149d87e877cb003440

Contents?: true

Size: 399 Bytes

Versions: 10

Compression:

Stored size: 399 Bytes

Contents

#
# Linear Motion. 
# 
# Changing a variable to create a moving line.  
# When the line moves off the edge of the window, 
# the variable is set to 0, which places the line
# back at the bottom of the screen. 
#
 
attr_reader :a

def setup
  size(640, 360)
  stroke(255)
  @a = height/2
end

def draw
  background(51)
  line(0, a, width, a) 
  @a = a - 0.5
  if (a < 0) 
    @a = height; 
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby-processing-2.6.3 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.6.2 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.6.1 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.6.0 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.5.1 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.5.0 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.4.4 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.4.3 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.4.2 samples/processing_app/topics/motion/linear.rb
ruby-processing-2.4.1 samples/processing_app/topics/motion/linear.rb