Sha256: dae1ea8876d03d289633a7423b16638f7896db9f05f2f2de559d7c5fa1f806ff

Contents?: true

Size: 611 Bytes

Versions: 10

Compression:

Stored size: 611 Bytes

Contents

# This example presents the fastest way to load a background image
# into Processing. To load an image as the background, it must be
# the same width and height as the program.

def setup
  size 200, 200
  frame_rate 30
  @a = 0
  
  # The background image must be the same size as the parameters
  # into the size method. In this program, the size of "milan_rubbish.jpg"
  # is 200 x 200 pixels.
  @background_image = load_image "milan_rubbish.jpg"
end

def draw
  background @background_image
  
  @a = (@a + 1) % (width+32)
  stroke 266, 204, 0
  line 0, @a,   width, @a-26
  line 0, @a-6, width, @a-32
end

Version data entries

10 entries across 10 versions & 1 rubygems

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