update do particles.each do |p| angle = noise[p.x * 0.005, p.y * 0.005, Time.now.to_f * 0.1] * Math::PI * 2 p.x += Math.cos(angle) * 2 p.y += Math.sin(angle) * 2 p.x = 0 if p.x > 800 p.x = 800 if p.x < 0 p.y = 0 if p.y > 600 p.y = 600 if p.y < 0 Rectangle.new(x: p.x, y: p.y, width: 2, height: 2, color: 'white') end end
show require 'svg' svg = SVG.new(width: 500, height: 500) ruby sketch
show require 'ruby2d' set width: 800, height: 600 update do particles