Skip to content

Commit ac35100

Browse files
committed
simplify playground + add edit hint
1 parent d82c732 commit ac35100

File tree

5 files changed

+107
-32
lines changed

5 files changed

+107
-32
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
22
<a href="https://blobs.dev">
3-
<img width="460" height="300" src="./logo/color.svg">
3+
<img width="460" height="300" src="./assets/logo-color.svg">
44
</a>
55
<br>
66
<a href="https://www.npmjs.com/package/blobs">
@@ -84,5 +84,5 @@ const options = {
8484

8585
<p align="center">
8686
<br><br>
87-
<img width="100" src="./logo/grey.svg" />
87+
<img width="100" src="./assets/logo-grey.svg" />
8888
</p>

assets/edit.svg

Lines changed: 47 additions & 0 deletions
Loading
File renamed without changes.
File renamed without changes.

index.html

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,28 @@
33
<meta charset="UTF-8">
44
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
55
<title>blobs</title>
6+
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400" rel="stylesheet">
67
<script src="https://unpkg.com/blobs"></script>
78
</head>
89
<body>
910
<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+
1022
body {
11-
display: table;
12-
font-family: monospace;
23+
display: flex;
24+
flex-direction: column;
1325
font-size: 1.1em;
1426
height: 100%;
27+
justify-content: center;
1528
left: 0;
1629
margin: 0;
1730
position: absolute;
@@ -22,16 +35,12 @@
2235
header {
2336
padding: 40px 60px;
2437
position: fixed;
25-
}
26-
27-
.middle {
28-
display: table-cell;
29-
text-align: center;
30-
vertical-align: middle;
38+
top: 0;
3139
}
3240

3341
main {
34-
display: inline-block;
42+
display: flex;
43+
flex-direction: row;
3544
margin: 0 auto;
3645
}
3746

@@ -40,11 +49,23 @@
4049
vertical-align: middle;
4150
}
4251

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+
4365
#options {
44-
display: inline-block;
4566
font-size: 2em;
67+
padding: 20px;
4668
text-align: left;
47-
vertical-align: middle;
4869
}
4970

5071
#error {
@@ -64,28 +85,20 @@
6485

6586
<header>
6687
<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" />
6889
</a>
6990
</header>
7091

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">&nbsp;</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">&nbsp;</div>
89102

90103

91104
<!-- Regenerate the blob from current options. -->
@@ -94,6 +107,16 @@
94107
var optionsElem = document.getElementById("options");
95108
var errorElem = document.getElementById("error");
96109

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+
97120
function refresh() {
98121
if (!blobElem || !optionsElem || !errorElem) return;
99122

@@ -108,6 +131,11 @@
108131
return;
109132
}
110133

134+
if (parsedOptions && typeof parsedOptions === "object") {
135+
parsedOptions.size = 600;
136+
parsedOptions.color = "#ec576b";
137+
}
138+
111139
try {
112140
blobElem.innerHTML = blobs(parsedOptions);
113141
} catch (e) {

0 commit comments

Comments
 (0)