Sha256: 46fdf7560c0bab63ab7639dc4a14bdccea35e405013b846757aa9fc778cb12e7

Contents?: true

Size: 496 Bytes

Versions: 1

Compression:

Stored size: 496 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-0.4.0 examples/sample11a.rb