Sha256: d685a1a7b91f93a8faa57915c249aec73a74b0e151604ada419db7299dbf8ebf

Contents?: true

Size: 463 Bytes

Versions: 2

Compression:

Stored size: 463 Bytes

Contents

# Redraw. 
# 
# The redraw() function makes draw() execute once.  
# In this example, draw() is executed once every time 
# the mouse is clicked. 

class Redraw < Processing::App

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

Redraw.new :title => "Redraw"

Version data entries

2 entries across 2 versions & 1 rubygems

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