Ruby Sketch Fixed Instant
show require 'ruby2d' set width: 500, height: 500
Run: ruby sketch.rb Draw. Experiment. Break things. Repeat.
def draw_circle(x, y, radius, depth) return if depth > 5 || radius < 2 Circle.new(x: x, y: y, radius: radius, color: "hsl(#depth * 60, 100%, 50%)") draw_circle(x + radius/2, y, radius/2, depth + 1) draw_circle(x - radius/2, y, radius/2, depth + 1) draw_circle(x, y + radius/2, radius/2, depth + 1) end ruby sketch
svg.rect(x: 0, y: 0, width: '100%', height: '100%', fill: '#111')
show require 'ruby2d' set width: 800, height: 600 show require 'ruby2d' set width: 500, height: 500
(0...800).each do |x| (0...600).each do |y| # Mandelbrot or pattern color = ((x ^ y) % 256) png[x, y] = ChunkyPNG::Color.rgb(color, color, color) end end
show require 'ruby2d' set title: "Interactive Sketch" Repeat
draw_circle(400, 300, 250, 1) show require 'ruby2d' require 'ruby_noise' # gem install ruby_noise set width: 800, height: 600, fps_cap: 30