Sha256: d6f88a9993d463403dce96aa60c19070580adc9c049d8f78b6be811933d54bda

Contents?: true

Size: 658 Bytes

Versions: 10

Compression:

Stored size: 658 Bytes

Contents

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

def setup    
  size 640, 360
  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 do |x|  	    
    xoff += increment
    yoff = 0.0  		
    (0...height).each do |y|  		    
      yoff += increment  			
      bright = noise( xoff, yoff, @zoff ) * 255  			
      pixels[x + y * width] = color(bright, bright, bright)
    end
  end  	
  update_pixels  	
  @zoff += z_increment  	
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby-processing-2.6.3 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.6.2 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.6.1 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.6.0 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.5.1 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.5.0 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.4.4 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.4.3 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.4.2 samples/processing_app/basics/math/noise_3_d.rb
ruby-processing-2.4.1 samples/processing_app/basics/math/noise_3_d.rb