Sha256: ea4c657029db6a3899ec0807f9a267cb886d7a32abdab599622032387462db63

Contents?: true

Size: 529 Bytes

Versions: 1

Compression:

Stored size: 529 Bytes

Contents

require "sgl"

def setup
  window -200, -200, 200, 200
  background 0
  $x1 = 0
  $y1 = 0
  $x2 = 0
  $y2 = 0
end
 
def display
  x = mouseX
  y = mouseY

  speed = 20.0
  vx = (x - $x1)/speed
  vy = (y - $y1)/speed
  $x1 = $x1 + vx
  $y1 = $y1 + vy
  color (200+$x1)/4, 0, 0
  circle($x1, $y1, 50, POLYGON)  ## polygonは塗りつぶし
  
  speed = 10.0
  vx = (x - $x2)/speed
  vy = (y - $y2)/speed
  $x2 = $x2 + vx
  $y2 = $y2 + vy
  color 0,(200+$y2)/4,0
  circle($x2+30,$y2+30,80)
end
 
mainloop

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sgl-1.0.0 examples/sample11a.rb