Sha256: 83064ab79867a37b4bbb9b96142e6d138a2df9d37c18cd13f748833a566fe5d2

Contents?: true

Size: 699 Bytes

Versions: 2

Compression:

Stored size: 699 Bytes

Contents

# Noise3D. 
# 
# Using 3D noise to create simple animated texture. 
# Here, the third dimension ('z') is treated as time. 

class Noise3D < Processing::App

  def setup
    
    size 200, 200
    frame_rate 30
    
    @increment = 0.01
    @zoff = 0.0
    @z_increment = 0.02
    
  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, @zoff ) * 255
  			
  			pixels[x+y*width] = color bright
  		}
  	}
  	
  	update_pixels
  	
  	@zoff += @z_increment
  
  end
  
end

Noise3D.new :title => "Noise 3 D"

Version data entries

2 entries across 2 versions & 1 rubygems

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