Ruby Sketch -

show

class Particle attr_accessor :x, :y def initialize(x, y) @x, @y = x, y end end

require 'ruby2d' set width: 800, height: 600, title: "My Ruby Sketch", background: '#111' on :key_down do |e| clear if e.key == 'r' end ruby sketch

show require 'ruby2d' set width: 500, height: 500

show require 'svg' svg = SVG.new(width: 500, height: 500) show class Particle attr_accessor :x, :y def initialize(x,

gem install ruby2d svg chunky_png Check:

update do @x += 2 @square.x = @x @square.x = 0 if @x > 500 end show class Particle attr_accessor :x

show a) Recursive circles (Apollonian-like) require 'ruby2d' set width: 800, height: 600, background: 'black'