show require 'ruby2d' set width: 500, height: 500
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
on :mouse_down do |event| Circle.new(x: event.x, y: event.y, radius: 10, color: 'fuchsia') @points << [event.x, event.y] end ruby sketch
on :key_down do |event| clear if event.key == 'c' end
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 show require 'ruby2d' set width: 500, height: 500 200
show a) Recursive circles (Apollonian-like) require 'ruby2d' set width: 800, height: 600, background: 'black'
require 'ruby2d' set width: 800, height: 600, title: "My Ruby Sketch", background: '#111' on :key_down do |e| clear if e.key == 'r' end show require 'ruby2d' set width: 500
show require 'ruby2d' set width: 800, height: 600
Чтобы скачать модель Вам необходимо войти или зарегистрироваться