Ruby Sketch -

200.times do |i| x = rand(500) y = rand(500) r = rand(5..40) hue = (i * 3) % 360 svg.circle(cx: x, cy: y, r: r, fill: "hsl(#hue, 80%, 60%)", opacity: 0.7) end

This code creates a new Ruby Sketch window with a red rectangle and a red circle.

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 ruby sketch

Here's an example of a simple Ruby Sketch application:

Here is an example of a simple Ruby Sketch application: p.y * 0.005

Ruby Sketch can be used to build a wide range of desktop applications, including:

Unlike Processing (Java/JS) or p5.js, Ruby lacks a native, standardized creative coding framework — but several gems and techniques make it powerful for algorithmic art. 0 Rectangle.new(x: p.x

To get started with Ruby Sketch, you'll need to:

show