Ruby Sketch ((hot)) May 2026
Ruby2D for real-time, SVG + ChunkyPNG for static art. 3. Setting Up Install Ruby (≥ 3.0), then install gems:
show a) Recursive circles (Apollonian-like) require 'ruby2d' set width: 800, height: 600, background: 'black' ruby sketch
@points = []
500.times particles << Particle.new(rand(800), rand(600)) Ruby2D for real-time, SVG + ChunkyPNG for static art
Run: ruby test.rb a) Drawing primitives (Ruby2D) require 'ruby2d' set width: 800, height: 600, background: 'black' Shapes Circle.new(x: 200, y: 200, radius: 80, sectors: 32, color: 'red') Rectangle.new(x: 400, y: 100, width: 150, height: 150, color: 'blue') Line.new(x: 0, y: 500, x2: 800, y2: 400, width: 5, color: 'lime') Triangle.new(x1: 600, y1: 400, x2: 700, y2: 500, x3: 500, y3: 500, color: 'yellow') Ruby2D for real-time
# test.rb require 'ruby2d' set title: "Ruby Sketch Test" Square.new show
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