repl.it
@amasad/

Ruby Victor test

Ruby

No description

fork
loading
Files
  • main.rb
  • pacman.svg
  • Packager files
  • Gemfile
  • Gemfile.lock
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'victor'

svg = Victor::SVG.new width: 140, height: 100, style: { background: '#ddd' }

svg.build do 
  rect x: 10, y: 10, width: 120, height: 80, rx: 10, fill: '#666'
  
  circle cx: 50, cy: 50, r: 30, fill: 'yellow'
  circle cx: 58, cy: 32, r: 4, fill: 'black'
  polygon points: %w[45,50 80,30 80,70], fill: '#666'

  3.times do |i|
    x = 80 + i*18
    circle cx: x, cy: 50, r: 4, fill: 'yellow'
  end
end

svg.save 'pacman'
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]