Sha256: 299c12cb0396d39bfc82aa525b25ca1ae1ad40a45e50d4974e2d18e11345920c

Contents?: true

Size: 745 Bytes

Versions: 10

Compression:

Stored size: 745 Bytes

Contents

# Create Graphics. 
# 
# The createGraphics() function creates an object from the PGraphics class 
# (PGraphics is the main graphics and rendering context for Processing). 
# The beginDraw() method is necessary to prepare for drawing and endDraw() is
# necessary to finish. Use this class if you need to draw into an off-screen 
# graphics buffer or to maintain two contexts with different properties.


def setup    
  size 640, 380 
  @pg = create_graphics 400, 200
end

def draw  
  fill 0, 12
  rect 0, 0, width, height  	
  fill 255
  no_stroke
  ellipse mouse_x, mouse_y, 60, 60  	
  @pg.begin_draw
  @pg.background 51
  @pg.no_fill
  @pg.stroke 255
  @pg.ellipse mouse_x-60, mouse_y-60, 60, 60
  @pg.end_draw  	
  image @pg, 120, 60
end

Version data entries

10 entries across 10 versions & 1 rubygems

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