|
3 | 3 | <meta charset="UTF-8"> |
4 | 4 | <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> |
5 | 5 | <title>blobs</title> |
| 6 | + <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400" rel="stylesheet"> |
6 | 7 | <script src="https://unpkg.com/blobs"></script> |
7 | 8 | </head> |
8 | 9 | <body> |
9 | 10 | <style> |
| 11 | + * { |
| 12 | + color: #111; |
| 13 | + font-family: 'Roboto Mono', monospace; |
| 14 | + font-weight: 400; |
| 15 | + } |
| 16 | + |
| 17 | + html { |
| 18 | + font-size: 10px; |
| 19 | + overflow: hidden; |
| 20 | + } |
| 21 | + |
10 | 22 | body { |
11 | | - display: table; |
12 | | - font-family: monospace; |
| 23 | + display: flex; |
| 24 | + flex-direction: column; |
13 | 25 | font-size: 1.1em; |
14 | 26 | height: 100%; |
| 27 | + justify-content: center; |
15 | 28 | left: 0; |
16 | 29 | margin: 0; |
17 | 30 | position: absolute; |
|
22 | 35 | header { |
23 | 36 | padding: 40px 60px; |
24 | 37 | position: fixed; |
25 | | - } |
26 | | - |
27 | | - .middle { |
28 | | - display: table-cell; |
29 | | - text-align: center; |
30 | | - vertical-align: middle; |
| 38 | + top: 0; |
31 | 39 | } |
32 | 40 |
|
33 | 41 | main { |
34 | | - display: inline-block; |
| 42 | + display: flex; |
| 43 | + flex-direction: row; |
35 | 44 | margin: 0 auto; |
36 | 45 | } |
37 | 46 |
|
|
40 | 49 | vertical-align: middle; |
41 | 50 | } |
42 | 51 |
|
| 52 | + .options-container { |
| 53 | + display: flex; |
| 54 | + flex-direction: column; |
| 55 | + justify-content: center; |
| 56 | + padding-right: 200px; |
| 57 | + } |
| 58 | + |
| 59 | + .edit-me { |
| 60 | + height: 0px; |
| 61 | + transform: translate(180px, -120px); |
| 62 | + width: 200px; |
| 63 | + } |
| 64 | + |
43 | 65 | #options { |
44 | | - display: inline-block; |
45 | 66 | font-size: 2em; |
| 67 | + padding: 20px; |
46 | 68 | text-align: left; |
47 | | - vertical-align: middle; |
48 | 69 | } |
49 | 70 |
|
50 | 71 | #error { |
|
64 | 85 |
|
65 | 86 | <header> |
66 | 87 | <a href="http://github.com/g-harel/blobs"> |
67 | | - <img width="200" src="./logo/grey.svg" /> |
| 88 | + <img width="200" src="./assets/logo-grey.svg" /> |
68 | 89 | </a> |
69 | 90 | </header> |
70 | 91 |
|
71 | | - <div class="middle"> |
72 | | - <main> |
73 | | - <div id="blob"></div><!-- |
74 | | - --><pre id="options" contenteditable oninput="changed()">{ |
75 | | - size: 600, |
76 | | - complexity: 0.2, |
77 | | - contrast: 0.4, |
78 | | - color: "#ec576b", |
79 | | - stroke: { |
80 | | - width: 0, |
81 | | - color: "black", |
82 | | - }, |
83 | | - guides: false, |
84 | | - seed: "1234", |
85 | | -}</pre> |
86 | | - <div id="error"> </div> |
87 | | - </main> |
88 | | - </div> |
| 92 | + <main> |
| 93 | + <div id="blob"></div> |
| 94 | + <div class="options-container"> |
| 95 | + <div class="edit-me"> |
| 96 | + <img src="./assets/edit.svg" /> |
| 97 | + </div> |
| 98 | + <pre id="options" contenteditable oninput="changed()"></pre> |
| 99 | + </div> |
| 100 | + </main> |
| 101 | + <div id="error"> </div> |
89 | 102 |
|
90 | 103 |
|
91 | 104 | <!-- Regenerate the blob from current options. --> |
|
94 | 107 | var optionsElem = document.getElementById("options"); |
95 | 108 | var errorElem = document.getElementById("error"); |
96 | 109 |
|
| 110 | + // Initial options. |
| 111 | + if (optionsElem) { |
| 112 | + optionsElem.innerHTML = "{\n" + |
| 113 | + " complexity: 0.2,\n" + |
| 114 | + " contrast: 0.4,\n" + |
| 115 | + " guides: false,\n" + |
| 116 | + " seed: \"blobs\",\n" + |
| 117 | + "}"; |
| 118 | + } |
| 119 | + |
97 | 120 | function refresh() { |
98 | 121 | if (!blobElem || !optionsElem || !errorElem) return; |
99 | 122 |
|
|
108 | 131 | return; |
109 | 132 | } |
110 | 133 |
|
| 134 | + if (parsedOptions && typeof parsedOptions === "object") { |
| 135 | + parsedOptions.size = 600; |
| 136 | + parsedOptions.color = "#ec576b"; |
| 137 | + } |
| 138 | + |
111 | 139 | try { |
112 | 140 | blobElem.innerHTML = blobs(parsedOptions); |
113 | 141 | } catch (e) { |
|
0 commit comments