Sha256: 1fab00b5d882d22f0413027ef2b7924db6f62de8a34233bff090a82013c2d1da

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

# Loop. 
# 
# The loop() function causes draw() to execute
# continuously. If noLoop is called in setup()
# the draw() is only executed once. In this example
# click the mouse to execute loop(), which will
# cause the draw() the execute continuously. 

class Loop < Processing::App

  def setup
    
    size 200, 200
    stroke 255
    
    no_loop # stops program
    
    @y = 100
  end
  
  def draw
  
  	background 0
  	
  	line 0, @y, width, @y
  	
  	@y = @y - 1
  	
  	@y = height if @y < 0
  end
  
  def mouse_pressed
  
  	loop # starts program
  end
  
end

Loop.new :title => "Loop"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-processing-1.0.11 samples/processing_app/basics/structure/loop.rb
ruby-processing-1.0.10.1 samples/processing_app/basics/structure/loop.rb