perfect-gui 3.4.5 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -7
- package/package.json +1 -1
- package/src/index.js +35 -10
- package/src/styles.js +24 -6
- package/test/src/index.html +17 -24
- package/test/src/index.js +2 -2
- package/test/src/js/basics.js +7 -3
- package/test/src/js/{full_featured.js → demo.js} +3 -3
- package/test/src/styles/main.scss +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ const gui = new GUI({
|
|
|
61
61
|
// Defines if the panel can be manually moved across the screen.
|
|
62
62
|
// Default is false.
|
|
63
63
|
|
|
64
|
-
autoRepositioning: true
|
|
64
|
+
autoRepositioning: true,
|
|
65
65
|
// If set to true, the panel position will be reset when the screen is resized.
|
|
66
66
|
// If a panel has been dragged, it won't be be affected.
|
|
67
67
|
// Default is true.
|
|
@@ -77,15 +77,13 @@ const gui = new GUI({
|
|
|
77
77
|
<tr><td>button</td><td>
|
|
78
78
|
|
|
79
79
|
```javascript
|
|
80
|
-
gui.button('Click me!',
|
|
81
|
-
...
|
|
82
|
-
});
|
|
80
|
+
gui.button('Click me!', callback);
|
|
83
81
|
```
|
|
84
82
|
</td></tr>
|
|
85
83
|
<tr><td>image</td><td>
|
|
86
84
|
|
|
87
85
|
```javascript
|
|
88
|
-
gui.image('Click this', 'path/to/image', () => {
|
|
86
|
+
gui.image('Click this', 'path/to/image', (path) => {
|
|
89
87
|
...
|
|
90
88
|
});
|
|
91
89
|
```
|
|
@@ -145,6 +143,14 @@ gui.vector2('Position', {
|
|
|
145
143
|
});
|
|
146
144
|
```
|
|
147
145
|
</td></tr>
|
|
146
|
+
<tr><td>color</td><td>
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
gui.color('Color', '#ff0000', color => {
|
|
150
|
+
console.log('Selected color:', color);
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
</td></tr>
|
|
148
154
|
<tr><td>folder</td><td>
|
|
149
155
|
|
|
150
156
|
```javascript
|
|
@@ -166,6 +172,6 @@ gui.toggleClose();
|
|
|
166
172
|
|
|
167
173
|
|
|
168
174
|
## To do
|
|
169
|
-
- Color palette component
|
|
170
175
|
- Vector2 drag & drop
|
|
171
|
-
|
|
176
|
+
- Style list component
|
|
177
|
+
- Image button selection outline
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export default class GUI {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
this.name = (options != undefined && typeof options.name == "string") ? options.name : '';
|
|
21
|
-
this.
|
|
21
|
+
this.backgroundColor = options.color || null;
|
|
22
22
|
|
|
23
23
|
if ( this instanceof GUI ) {
|
|
24
24
|
if ( typeof GUI[GUI.instanceCounter] != 'number' ) {
|
|
@@ -73,7 +73,7 @@ export default class GUI {
|
|
|
73
73
|
max-height: ${this.maxHeight}px;
|
|
74
74
|
transform: translate3d(${this.xOffset}px,${this.yOffset}px,0);
|
|
75
75
|
${ this.screenCorner.y == 'top' ? '' : 'top: auto; bottom: 0;' }
|
|
76
|
-
${ this.
|
|
76
|
+
${ this.backgroundColor ? 'background: ' + this.backgroundColor + ';' : '' }
|
|
77
77
|
}`);
|
|
78
78
|
|
|
79
79
|
if (options.autoRepositioning != false) window.addEventListener('resize', this._handleResize.bind(this));
|
|
@@ -142,6 +142,8 @@ export default class GUI {
|
|
|
142
142
|
if (element.onchange) domElement.onchange = element.onchange;
|
|
143
143
|
if (element.textContent) domElement.textContent = element.textContent;
|
|
144
144
|
if (element.innerHTML) domElement.innerHTML = element.innerHTML;
|
|
145
|
+
if (element.type) domElement.type = element.type;
|
|
146
|
+
if (element.value) domElement.value = element.value;
|
|
145
147
|
if (element.customAttributes) {
|
|
146
148
|
for (var i in element.customAttributes) {
|
|
147
149
|
domElement.setAttribute(i, element.customAttributes[i]);
|
|
@@ -167,7 +169,7 @@ export default class GUI {
|
|
|
167
169
|
parent: this.wrapper,
|
|
168
170
|
class: 'p-gui__header',
|
|
169
171
|
textContent: this.name,
|
|
170
|
-
inline: `${ this.
|
|
172
|
+
inline: `${ this.backgroundColor ? 'border-color: ' + this.backgroundColor + ';' : ''}`
|
|
171
173
|
});
|
|
172
174
|
|
|
173
175
|
this._createElement({
|
|
@@ -246,13 +248,14 @@ export default class GUI {
|
|
|
246
248
|
value: 'number'
|
|
247
249
|
}, params);
|
|
248
250
|
} else {
|
|
251
|
+
object = params.obj || params.object;
|
|
252
|
+
prop = params.prop || params.property;
|
|
253
|
+
|
|
249
254
|
this._checkMandatoryParams({
|
|
250
255
|
object: 'object',
|
|
251
256
|
prop: 'string'
|
|
252
|
-
},
|
|
257
|
+
}, {object, prop});
|
|
253
258
|
|
|
254
|
-
object = params.object;
|
|
255
|
-
prop = params.prop;
|
|
256
259
|
propReferenceIndex = this.propReferences.push(object[prop]) - 1;
|
|
257
260
|
isObject = true;
|
|
258
261
|
}
|
|
@@ -399,12 +402,12 @@ export default class GUI {
|
|
|
399
402
|
const minY = data.y.min ?? 0;
|
|
400
403
|
const maxY = data.y.max ?? 1;
|
|
401
404
|
|
|
402
|
-
const objectX = data.x.object;
|
|
403
|
-
const propX = data.x.prop;
|
|
405
|
+
const objectX = data.x.obj || data.x.object;
|
|
406
|
+
const propX = data.x.prop || data.x.property;
|
|
404
407
|
const propXReferenceIndex = this.propReferences.push(objectX[propX]) - 1;
|
|
405
408
|
|
|
406
|
-
const objectY = data.y.object;
|
|
407
|
-
const propY = data.y.prop;
|
|
409
|
+
const objectY = data.y.obj || data.y.object;
|
|
410
|
+
const propY = data.y.prop || data.y.property;
|
|
408
411
|
const propYReferenceIndex = this.propReferences.push(objectY[propY]) - 1;
|
|
409
412
|
|
|
410
413
|
this.imageContainer = null;
|
|
@@ -471,6 +474,28 @@ export default class GUI {
|
|
|
471
474
|
});
|
|
472
475
|
}
|
|
473
476
|
|
|
477
|
+
color(text, value, callback) {
|
|
478
|
+
const container = this._createElement({
|
|
479
|
+
el: 'div',
|
|
480
|
+
class: 'p-gui__color',
|
|
481
|
+
textContent: text,
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
const colorpicker = this._createElement({
|
|
485
|
+
parent: container,
|
|
486
|
+
el: 'input',
|
|
487
|
+
class: 'p-gui__color-picker',
|
|
488
|
+
type: 'color',
|
|
489
|
+
value
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
if (callback) {
|
|
493
|
+
colorpicker.addEventListener('input', () => {
|
|
494
|
+
callback(colorpicker.value);
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
474
499
|
folder(options = {}) {
|
|
475
500
|
let closed = typeof options.closed == 'boolean' ? options.closed : false;
|
|
476
501
|
let name = options.name || '';
|
package/src/styles.js
CHANGED
|
@@ -92,7 +92,8 @@ return /* css */`
|
|
|
92
92
|
.p-gui__button,
|
|
93
93
|
.p-gui__switch,
|
|
94
94
|
.p-gui__list,
|
|
95
|
-
.p-gui__vector2
|
|
95
|
+
.p-gui__vector2,
|
|
96
|
+
.p-gui__color {
|
|
96
97
|
width: 100%;
|
|
97
98
|
padding: 7px;
|
|
98
99
|
font-size: 11px;
|
|
@@ -177,10 +178,6 @@ return /* css */`
|
|
|
177
178
|
pointer-events: none;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
.p-gui__list {
|
|
181
|
-
cursor: default;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
181
|
.p-gui__switch-checkbox {
|
|
185
182
|
width: 5px;
|
|
186
183
|
height: 5px;
|
|
@@ -199,7 +196,13 @@ return /* css */`
|
|
|
199
196
|
box-shadow: 0 0 5px #00ff89;
|
|
200
197
|
}
|
|
201
198
|
|
|
202
|
-
.p-gui__list
|
|
199
|
+
.p-gui__list,
|
|
200
|
+
.p-gui__color {
|
|
201
|
+
cursor: default;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.p-gui__list-dropdown,
|
|
205
|
+
.p-gui__color-picker {
|
|
203
206
|
position: absolute;
|
|
204
207
|
right: 5px;
|
|
205
208
|
top: 0;
|
|
@@ -209,6 +212,21 @@ return /* css */`
|
|
|
209
212
|
cursor: pointer;
|
|
210
213
|
}
|
|
211
214
|
|
|
215
|
+
.p-gui__color-picker {
|
|
216
|
+
-webkit-appearance: none;
|
|
217
|
+
padding: 0;
|
|
218
|
+
background-color: transparent;
|
|
219
|
+
height: 15px;
|
|
220
|
+
border: 1px solid #222222;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.p-gui__color-picker::-webkit-color-swatch-wrapper {
|
|
224
|
+
padding: 0;
|
|
225
|
+
}
|
|
226
|
+
.p-gui__color-picker::-webkit-color-swatch {
|
|
227
|
+
border: none;
|
|
228
|
+
}
|
|
229
|
+
|
|
212
230
|
.p-gui__slider {
|
|
213
231
|
width: 100%;
|
|
214
232
|
margin-bottom: 8px;
|
package/test/src/index.html
CHANGED
|
@@ -25,22 +25,17 @@
|
|
|
25
25
|
<span style="color: #a6e22e">x</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">0</span>
|
|
26
26
|
<span style="color: #f8f8f2">};</span>
|
|
27
27
|
|
|
28
|
-
<span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">GUI</span><span style="color: #f8f8f2">({</span>
|
|
29
|
-
<span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Basics'</span>
|
|
30
|
-
<span style="color: #f8f8f2">});</span>
|
|
28
|
+
<span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">GUI</span><span style="color: #f8f8f2">({</span> <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Basics'</span> <span style="color: #f8f8f2">});</span>
|
|
31
29
|
|
|
32
30
|
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">button</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'Button'</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">changeColor</span><span style="color: #f8f8f2">);</span>
|
|
33
31
|
|
|
34
|
-
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">slider</span><span style="color: #f8f8f2">({</span>
|
|
35
|
-
<span style="color: #a6e22e">
|
|
36
|
-
|
|
37
|
-
<span style="color: #f8f8f2">},</span> <span style="color: #a6e22e">value</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{</span>
|
|
38
|
-
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">opacity</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">value</span>
|
|
39
|
-
<span style="color: #f8f8f2">});</span>
|
|
32
|
+
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">slider</span><span style="color: #f8f8f2">({</span> <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Slider (simple callback)'</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">value</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">1</span> <span style="color: #f8f8f2">},</span>
|
|
33
|
+
<span style="color: #a6e22e">value</span> <span style="color: #f92672">=></span> <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">opacity</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">value</span>
|
|
34
|
+
<span style="color: #f8f8f2">);</span>
|
|
40
35
|
|
|
41
36
|
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">slider</span><span style="color: #f8f8f2">({</span>
|
|
42
37
|
<span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'Slider 2 (object binding)'</span><span style="color: #f8f8f2">,</span>
|
|
43
|
-
<span style="color: #a6e22e">
|
|
38
|
+
<span style="color: #a6e22e">obj</span><span style="color: #f92672">:</span> <span style="color: #a6e22e">position</span><span style="color: #f8f8f2">,</span>
|
|
44
39
|
<span style="color: #a6e22e">prop</span><span style="color: #f92672">:</span> <span style="color: #e6db74">'x'</span><span style="color: #f8f8f2">,</span>
|
|
45
40
|
<span style="color: #a6e22e">min</span><span style="color: #f92672">:</span> <span style="color: #f92672">-</span><span style="color: #ae81ff">30</span><span style="color: #f8f8f2">,</span>
|
|
46
41
|
<span style="color: #a6e22e">max</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">30</span><span style="color: #f8f8f2">,</span>
|
|
@@ -54,22 +49,19 @@
|
|
|
54
49
|
|
|
55
50
|
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">list</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'List'</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">[</span><span style="color: #e6db74">'red'</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">'pink'</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">'yellow'</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">'blue'</span><span style="color: #f8f8f2">],</span> <span style="color: #a6e22e">item</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{</span>
|
|
56
51
|
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">item</span><span style="color: #f8f8f2">;</span>
|
|
57
|
-
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundImage</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">'none'</span><span style="color: #f8f8f2">;</span>
|
|
58
52
|
<span style="color: #f8f8f2">});</span>
|
|
59
53
|
|
|
60
|
-
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">image</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'Image 1'</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">'path/to/image-1.jpg'</span><span style="color: #f8f8f2">,</span>
|
|
61
|
-
<span style="color: #a6e22e">
|
|
62
|
-
|
|
63
|
-
<span style="color: #f8f8f2">document.</span><span style="color: #a6e22e">querySelector</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'#container-1 .note'</span><span style="color: #f8f8f2">).</span><span style="color: #a6e22e">textContent</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">"Photo by Joel Filipe on Unsplash"</span><span style="color: #f8f8f2">;</span>
|
|
64
|
-
<span style="color: #f8f8f2">}</span>
|
|
65
|
-
<span style="color: #f8f8f2">);</span>
|
|
54
|
+
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">image</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'Image 1'</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">'path/to/image-1.jpg'</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">evt</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{</span>
|
|
55
|
+
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundImage</span> <span style="color: #f92672">=</span> <span style="color: #960050; background-color: #1e0010">`</span><span style="color: #a6e22e">url</span><span style="color: #f8f8f2">(</span><span style="color: #a6e22e">$</span><span style="color: #f8f8f2">{</span><span style="color: #a6e22e">evt</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">path</span><span style="color: #f8f8f2">})</span><span style="color: #960050; background-color: #1e0010">`</span><span style="color: #f8f8f2">;</span>
|
|
56
|
+
<span style="color: #f8f8f2">});</span>
|
|
66
57
|
|
|
67
|
-
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">image</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'Image 2'</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">'path/to/image-2.jpg'</span><span style="color: #f8f8f2">,</span>
|
|
68
|
-
<span style="color: #a6e22e">
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<span style="color: #f8f8f2">
|
|
58
|
+
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">image</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'Image 2'</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">'path/to/image-2.jpg'</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">evt</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{</span>
|
|
59
|
+
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundImage</span> <span style="color: #f92672">=</span> <span style="color: #960050; background-color: #1e0010">`</span><span style="color: #a6e22e">url</span><span style="color: #f8f8f2">(</span><span style="color: #a6e22e">$</span><span style="color: #f8f8f2">{</span><span style="color: #a6e22e">evt</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">path</span><span style="color: #f8f8f2">})</span><span style="color: #960050; background-color: #1e0010">`</span><span style="color: #f8f8f2">;</span>
|
|
60
|
+
<span style="color: #f8f8f2">});</span>
|
|
61
|
+
|
|
62
|
+
<span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">color</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">'Color'</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">'#ff0000'</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">color</span> <span style="color: #f92672">=></span> <span style="color: #f8f8f2">{</span>
|
|
63
|
+
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">color</span><span style="color: #f8f8f2">;</span>
|
|
64
|
+
<span style="color: #f8f8f2">});</span>
|
|
73
65
|
|
|
74
66
|
<span style="color: #66d9ef">function</span> <span style="color: #a6e22e">loop</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">{</span>
|
|
75
67
|
<span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">transform</span> <span style="color: #f92672">=</span> <span style="color: #960050; background-color: #1e0010">`</span><span style="color: #a6e22e">translateX</span><span style="color: #f8f8f2">(</span><span style="color: #a6e22e">$</span><span style="color: #f8f8f2">{</span><span style="color: #a6e22e">position</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">x</span><span style="color: #f8f8f2">}</span><span style="color: #a6e22e">px</span><span style="color: #f8f8f2">)</span><span style="color: #960050; background-color: #1e0010">`</span><span style="color: #f8f8f2">;</span>
|
|
@@ -77,7 +69,8 @@
|
|
|
77
69
|
<span style="color: #f8f8f2">}</span>
|
|
78
70
|
|
|
79
71
|
<span style="color: #a6e22e">loop</span><span style="color: #f8f8f2">();</span>
|
|
80
|
-
</pre></div>
|
|
72
|
+
</pre></div>
|
|
73
|
+
|
|
81
74
|
</div>
|
|
82
75
|
|
|
83
76
|
<h2>Vectors</h2>
|
package/test/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './styles/main.scss';
|
|
2
|
-
import
|
|
2
|
+
//import demo from './js/demo';
|
|
3
3
|
import basics from './js/basics';
|
|
4
4
|
import vectors from './js/vectors';
|
|
5
5
|
import multiple from './js/multiple';
|
|
@@ -7,7 +7,7 @@ import folders from './js/folders';
|
|
|
7
7
|
import other from './js/other';
|
|
8
8
|
import kill_create from './js/kill_create';
|
|
9
9
|
|
|
10
|
-
//
|
|
10
|
+
//demo();
|
|
11
11
|
|
|
12
12
|
basics();
|
|
13
13
|
|
package/test/src/js/basics.js
CHANGED
|
@@ -25,8 +25,7 @@ export default function basics() {
|
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
gui.slider({ name: 'Slider 2 (object binding)',
|
|
29
|
-
);
|
|
28
|
+
gui.slider({ name: 'Slider 2 (object binding)', obj: position, prop: 'x', min: -30, max: 30, step: .1 });
|
|
30
29
|
|
|
31
30
|
gui.toggle('Switch', true, state => {
|
|
32
31
|
if ( state ) element.classList.remove('round');
|
|
@@ -34,8 +33,8 @@ export default function basics() {
|
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
gui.list('List', ['red', 'pink', 'yellow', 'blue'], item => {
|
|
37
|
-
element.style.backgroundColor = item;
|
|
38
36
|
element.style.backgroundImage = 'none';
|
|
37
|
+
element.style.backgroundColor = item;
|
|
39
38
|
});
|
|
40
39
|
|
|
41
40
|
gui.image('Image 1',
|
|
@@ -54,6 +53,11 @@ export default function basics() {
|
|
|
54
53
|
}
|
|
55
54
|
);
|
|
56
55
|
|
|
56
|
+
gui.color('Color', '#ff0000', color => {
|
|
57
|
+
element.style.backgroundImage = 'none';
|
|
58
|
+
element.style.backgroundColor = color;
|
|
59
|
+
});
|
|
60
|
+
|
|
57
61
|
function loop() {
|
|
58
62
|
element.style.transform = `translateX(${position.x}px)`;
|
|
59
63
|
requestAnimationFrame(loop);
|
|
@@ -28,17 +28,17 @@ export default function()
|
|
|
28
28
|
|
|
29
29
|
folder1.image(
|
|
30
30
|
'The officer',
|
|
31
|
-
require('../img/DALL·E
|
|
31
|
+
require('../img/DALL·E-2022-11-13-20.11.16---portrait-of-a-squirrel-in-an-officier-suit,-style-of-a-Rembrandt-painting.jpg'),
|
|
32
32
|
() => {}
|
|
33
33
|
);
|
|
34
34
|
folder1.image(
|
|
35
35
|
'Weird dream',
|
|
36
|
-
require('../img/DALL·E
|
|
36
|
+
require('../img/DALL·E-2022-11-13-20.11.52---a-blonde-girl-riding-a-whale-in-the-style-of-hopper.jpg'),
|
|
37
37
|
() => {}
|
|
38
38
|
);
|
|
39
39
|
folder1.image(
|
|
40
40
|
'Friends',
|
|
41
|
-
require('../img/DALL·E
|
|
41
|
+
require('../img/DALL·E-2022-11-13-20.13.55---1-blonde-haired-girl-with-her-orange-cat,-watching-the-whales-in-Tadoussac,-Canada.-In-the-style-of-an-oil-painting..jpg'),
|
|
42
42
|
() => {}
|
|
43
43
|
);
|
|
44
44
|
|
|
@@ -94,7 +94,7 @@ pre {
|
|
|
94
94
|
background-position: center;
|
|
95
95
|
background-repeat: no-repeat;
|
|
96
96
|
border: 1px solid black;
|
|
97
|
-
transition: .1s transform ease, .3s border-radius ease
|
|
97
|
+
transition: .1s transform ease, .3s border-radius ease;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
.element.round {
|