Sha256: 9ef91db7a6a9c13dfbe86225817f944d7bb53b90c2fcb7286ad7a869f1474905

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

# Noise2D 
# by Daniel Shiffman.  
# 
# Using 2D noise to create simple texture. 

class Noise2D < Processing::App

  def setup
    
    size 200, 200
    
    @increment = 0.02
    
    no_loop
    
  end
  
  def draw
  
  	background 0
  	
  	load_pixels
  	
  	xoff = 0.0
  	
  	(0...width).each { |x|
  	
  		xoff += @increment
  		yoff = 0.0
  		
  		(0...height).each { |y|
  		
  			yoff += @increment
  			
  			bright = noise( xoff, yoff) * 255
  			
  			pixels[x+y*width] = color bright
  		}
  	}
  	
  	update_pixels
  
  end
  
end

Noise2D.new :title => "Noise 2 D"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-processing-1.0.11 samples/processing_app/basics/math/noise_2_d.rb
ruby-processing-1.0.10.1 samples/processing_app/basics/math/noise_2_d.rb