Sha256: 8ea3c13bf567815e645c38481661c167fef95ab662df473c915c744726131ec2

Contents?: true

Size: 566 Bytes

Versions: 10

Compression:

Stored size: 566 Bytes

Contents

# Translate. 
# 
# The translate() function allows objects to be moved
# to any location within the window. The first parameter
# sets the x-axis offset and the second parameter sets the
# y-axis offset. 


def setup    
  size 640, 360
  no_stroke
  frame_rate 30    
  @x, @y = 0.0, 0.0
  @size = 80.0
end

def draw    
  background 102  	
  @x += 0.8  	
  @x = -@size if @x > width + @size  	
  translate @x, height/2 - @size/2  	
  fill 255
  rect -@size/2, -@size/2, @size, @size  	
  translate @x, @size  	
  fill 0
  rect -@size/2, -@size/2, @size, @size
end

Version data entries

10 entries across 10 versions & 1 rubygems

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