Last active
September 6, 2023 09:41
-
-
Save roktas/8ea8240e195d066d7d2745fc2ca11b4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '10_pacman' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S ruby -rsevgi/script | |
SVG width: 140, height: 100, style: { background: '#ddd' } 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' | |
Hrepeat(id: "dot", ny: 3, dy: 18) do | |
circle cx: 80, cy: 50, r: 4, fill: 'yellow' | |
end | |
end.Out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment