Skip to content

Instantly share code, notes, and snippets.

@mmmries
Last active August 29, 2015 14:17
Show Gist options
  • Save mmmries/0f9ca23bd9a3c6311846 to your computer and use it in GitHub Desktop.
Save mmmries/0f9ca23bd9a3c6311846 to your computer and use it in GitHub Desktop.
Showoff Drawings
shapes = [
{:octagon, %{cx: 50, cy: 50, r: 40, fill: "orange"}},
{:circle, %{cx: 12, cy: 12, r: 10}, nil},
{:circle, %{cx: 88, cy: 12, r: 10}, nil},
{:circle, %{cx: 12, cy: 88, r: 10}, nil},
{:circle, %{cx: 88, cy: 88, r: 10}, nil},
{:pentagon, %{
cx: 50,
cy: 50,
r: 30,
transform: "rotate(36, 50, 50)"}},
]
landscape = [
{:background, "lightblue"},
{:hills, %{points: [{20,80},{40,70},{75,80},{100,85}], fill: "lightgreen", stroke: "green"}},
{:circle, %{cx: 75, cy: 25, r: 20, fill: "yellow", stroke: "orange"}, nil},
]
couchdb = [
{:path, %{d: "M1,80 L1,35 8,35 8,20 92,20 92,35 99,35 99,80 z", fill: "rgb(251,1,22)", stroke: "rgb(185,16,34)", "stroke-width": "4.5%"}, nil},
{:path, %{d: "M12,78.5 L12,66.5 32,70 88,65.5 88,78.5 z", fill: "rgb(185,16,34)"}, nil},
{:path, %{d: "M12,58.5 L12,40.5 50,40.5 68,54.5 88,40.5 88,58.5 32,62 z", fill: "rgb(185,16,34)"}, nil},
{:path, %{d: "M13,17.5 L13,25 17,28 3,33, 3,47 7,50 7,43 9,46 9,40.5 12,40.5 20,60 25,60.7 28,82 38,82 36,61.4 51,52 61,59 62.5,58.5 63,60.3 79,59 78,56 70,54 50,40 40,47 33,31 46,22 53,22 55,24 55,22 59,22 58,17 38,17 25,25 25,17 z", fill: "white"}, nil},
]
blue_grid = [
# create a ":box" shortcut to represent a small blue square
{:def, :box, {:rect, %{x: 0.2, y: 0.2, width: 9.6, height: 9.6, fill: "blue"}, nil}},
# create a ":row" shortcut to represent a row of boxes
{:def, :row, {:g, %{}, [
{:box, %{transform: "translate(0 , 0)"}},
{:box, %{transform: "translate(10, 0)"}},
{:box, %{transform: "translate(20, 0)"}},
{:box, %{transform: "translate(30, 0)"}},
{:box, %{transform: "translate(40, 0)"}},
{:box, %{transform: "translate(50, 0)"}},
{:box, %{transform: "translate(60, 0)"}},
{:box, %{transform: "translate(70, 0)"}},
{:box, %{transform: "translate(80, 0)"}},
{:box, %{transform: "translate(90, 0)"}}
]}},
# then we create 10 rows and move them to fill the view area
{:row, %{transform: "translate(0,0)"}},
{:row, %{transform: "translate(0,10)"}},
{:row, %{transform: "translate(0,20)"}},
{:row, %{transform: "translate(0,30)"}},
{:row, %{transform: "translate(0,40)"}},
{:row, %{transform: "translate(0,50)"}},
{:row, %{transform: "translate(0,60)"}},
{:row, %{transform: "translate(0,70)"}},
{:row, %{transform: "translate(0,80)"}},
{:row, %{transform: "translate(0,90)"}},
]
triforce = [
{:triangle, %{cx: 50, cy: 40, r: 50, transform: "rotate(180, 50,50)", fill: "green"}},
{:triangle, %{cx: 50, cy: 60, r: 25, fill: "white"}},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment