Sha256: a78a003046018ada6faab1e2ddcc1e305ee7506f19f4bbd3be80c87fbcbaab13

Contents?: true

Size: 516 Bytes

Versions: 10

Compression:

Stored size: 516 Bytes

Contents

# Distance 2D. 
# 
# Move the mouse across the image to obscure and reveal the matrix.  
# Measures the distance from the mouse to each square and sets the
# size proportionally. 

def setup    
  size 640, 360    
  no_stroke
  @max_distance = dist(0, 0, width, height)    
end

def draw  
  background 51  
  (0..width).step(20) do |i|  	
    (0..height).step(20) do |j|  		
      size = dist(mouse_x, mouse_y, i, j) 
      size = size / @max_distance * 66      
      ellipse i, j, size, size
    end
  end  
end

Version data entries

10 entries across 10 versions & 1 rubygems

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