Ruby Sketch Page

# test.rb require 'ruby2d' set title: "Ruby Sketch Test" Square.new show

show require 'svg' svg = SVG.new(width: 500, height: 500)

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

gem install ruby2d svg chunky_png Check:

500.times particles << Particle.new(rand(800), rand(600)) # test

(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

svg.rect(x: 0, y: 0, width: '100%', height: '100%', fill: '#111') y] = ChunkyPNG::Color.rgb(color

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