Ruby: Sketch
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')
100.times do Circle.new( x: rand(800), y: rand(600), radius: rand(5..30), color: ['red', 'green', 'blue', 'yellow', 'purple'].sample, opacity: rand(0.3..0.8) ) end ruby sketch
show a) Recursive circles (Apollonian-like) require 'ruby2d' set width: 800, height: 600, background: 'black' Run: ruby test
show
# test.rb require 'ruby2d' set title: "Ruby Sketch Test" Square.new show background: 'black' Shapes Circle.new(x: 200
show require 'svg' svg = SVG.new(width: 500, height: 500)
show require 'ruby2d' set width: 500, height: 500

