perfect-gui 3.5.16 → 4.0.1
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 +12 -99
- package/package.json +1 -1
- package/src/index.js +173 -121
- package/src/styles.js +17 -8
- package/test/src/index.html +390 -102
- package/test/src/index.js +21 -7
- package/test/src/js/{basics.js → methods/basics.js} +12 -12
- package/test/src/js/methods/button.js +15 -0
- package/test/src/js/methods/color.js +14 -0
- package/test/src/js/methods/folder.js +34 -0
- package/test/src/js/methods/image.js +17 -0
- package/test/src/js/methods/list.js +14 -0
- package/test/src/js/methods/slider.js +26 -0
- package/test/src/js/methods/toggle.js +15 -0
- package/test/src/js/methods/vector2.js +21 -0
- package/test/src/js/vectors.js +6 -6
- package/test/src/styles/_sidebar.css +45 -0
- package/test/src/styles/_table.css +21 -0
- package/test/src/styles/styles.css +26 -54
- package/test/src/js/folders.js +0 -27
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import GUI from '
|
|
2
|
-
import getRandomColor from '
|
|
1
|
+
import GUI from '../../../../src/index';
|
|
2
|
+
import getRandomColor from '../getRandomColor';
|
|
3
3
|
|
|
4
4
|
export default function basics() {
|
|
5
5
|
const position = {
|
|
@@ -31,38 +31,38 @@ export default function basics() {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
gui.toggle('Toggle', true, state => {
|
|
34
|
+
gui.toggle({ name: 'Toggle', state: true }, state => {
|
|
35
35
|
if ( state ) element.classList.remove('round');
|
|
36
36
|
else element.classList.add('round');
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
gui.
|
|
39
|
+
gui.options({ name: 'List', values: ['red', 'pink', 'yellow', 'blue'] }, option => {
|
|
40
40
|
element.style.backgroundImage = 'none';
|
|
41
|
-
element.style.backgroundColor =
|
|
41
|
+
element.style.backgroundColor = option;
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
gui.image('Image 1
|
|
45
|
-
'https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/img/DALL·E-2022-11-13-20.11.16---portrait-of-a-squirrel-in-an-officier-suit,-style-of-a-Rembrandt-painting.jpg',
|
|
44
|
+
gui.image({ name: 'Image 1',
|
|
45
|
+
path: 'https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/img/DALL·E-2022-11-13-20.11.16---portrait-of-a-squirrel-in-an-officier-suit,-style-of-a-Rembrandt-painting.jpg'},
|
|
46
46
|
evt => {
|
|
47
47
|
element.style.backgroundImage = `url(${evt.path})`;
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
|
|
51
|
-
gui.image('Image 2',
|
|
52
|
-
'https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/img/DALL·E-2022-11-13-20.11.52---a-blonde-girl-riding-a-whale-in-the-style-of-hopper.jpg',
|
|
51
|
+
gui.image({ name: 'Image 2',
|
|
52
|
+
path: 'https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/img/DALL·E-2022-11-13-20.11.52---a-blonde-girl-riding-a-whale-in-the-style-of-hopper.jpg'},
|
|
53
53
|
evt => {
|
|
54
54
|
element.style.backgroundImage = `url(${evt.path})`;
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
-
gui.image('Image 3',
|
|
59
|
-
'https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/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',
|
|
58
|
+
gui.image({ name: 'Image 3',
|
|
59
|
+
path: 'https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/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'},
|
|
60
60
|
evt => {
|
|
61
61
|
element.style.backgroundImage = `url(${evt.path})`;
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
64
|
|
|
65
|
-
gui.color('Color', '#
|
|
65
|
+
gui.color({ name: 'Color', value: '#06ff89'}, color => {
|
|
66
66
|
element.style.backgroundImage = 'none';
|
|
67
67
|
element.style.backgroundColor = color;
|
|
68
68
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import GUI from '../../../../src/index';
|
|
2
|
+
import getRandomColor from '../getRandomColor';
|
|
3
|
+
|
|
4
|
+
export default function button() {
|
|
5
|
+
const element = document.querySelector('#container-button .element');
|
|
6
|
+
|
|
7
|
+
const gui = new GUI({
|
|
8
|
+
container: '#container-button',
|
|
9
|
+
draggable: true
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
gui.button('Button', () => {
|
|
13
|
+
element.style.backgroundColor = getRandomColor();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import GUI from '../../../../src/index';
|
|
2
|
+
|
|
3
|
+
export default function color() {
|
|
4
|
+
const element = document.querySelector('#container-color .element');
|
|
5
|
+
|
|
6
|
+
const gui = new GUI({
|
|
7
|
+
container: '#container-color',
|
|
8
|
+
draggable: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
gui.color({ name: 'Color', value: '#06ff89' }, color => {
|
|
12
|
+
element.style.backgroundColor = color;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import getRandomColor from '../getRandomColor';
|
|
2
|
+
import GUI from '../../../../src/index';
|
|
3
|
+
|
|
4
|
+
export default function folder() {
|
|
5
|
+
const element = document.querySelector('#container-folder .element');
|
|
6
|
+
|
|
7
|
+
const gui = new GUI({
|
|
8
|
+
name: 'Folders',
|
|
9
|
+
container: '#container-folder'
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
let folder_1 = gui.folder({ name: 'Folder 1' });
|
|
13
|
+
|
|
14
|
+
folder_1.button('Button', () => {
|
|
15
|
+
let color = getRandomColor();
|
|
16
|
+
element.style.backgroundColor = color;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
folder_1.slider({ name: 'Slider', value: 1 }, value => {
|
|
20
|
+
element.style.transform = `scale(${value})`;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
let folder_2 = gui.folder({ name: 'Folder 2', color: '#993333' });
|
|
24
|
+
|
|
25
|
+
folder_2.button('Button', () => {
|
|
26
|
+
element.style.backgroundColor = getRandomColor();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
let folder_3 = gui.folder({ name: 'Folder 3', closed: true });
|
|
30
|
+
|
|
31
|
+
folder_3.button('Button', () => {
|
|
32
|
+
element.style.backgroundColor = getRandomColor();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import GUI from '../../../../src/index';
|
|
2
|
+
|
|
3
|
+
export default function image() {
|
|
4
|
+
const element = document.querySelector('#container-image .element');
|
|
5
|
+
|
|
6
|
+
const gui = new GUI({
|
|
7
|
+
container: '#container-image',
|
|
8
|
+
draggable: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
gui.image({ name: 'Lorem ipsum',
|
|
12
|
+
path: 'https://raw.githubusercontent.com/thibka/thibka.github.io/master/perfect-gui/_data/img/DALL·E-2022-11-13-20.11.16---portrait-of-a-squirrel-in-an-officier-suit,-style-of-a-Rembrandt-painting.jpg'},
|
|
13
|
+
evt => {
|
|
14
|
+
element.style.backgroundImage = `url( ${evt.path} )`;
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import GUI from '../../../../src/index';
|
|
2
|
+
|
|
3
|
+
export default function list() {
|
|
4
|
+
const element = document.querySelector('#container-list .element');
|
|
5
|
+
|
|
6
|
+
const gui = new GUI({
|
|
7
|
+
container: '#container-list',
|
|
8
|
+
draggable: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
gui.list({ name: 'List', values: ['red', 'pink', 'yellow', 'blue'] }, selected_value => {
|
|
12
|
+
element.style.backgroundColor = selected_value;
|
|
13
|
+
} );
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import GUI from '../../../../src/index';
|
|
2
|
+
import getRandomColor from '../getRandomColor';
|
|
3
|
+
|
|
4
|
+
export default function slider() {
|
|
5
|
+
const element = document.querySelector('#container-slider .element');
|
|
6
|
+
const position = {
|
|
7
|
+
x: 0,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const gui = new GUI({
|
|
11
|
+
container: '#container-slider',
|
|
12
|
+
draggable: true
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
gui.slider({ name: 'Simple slider (value & callback)', value: 1 },
|
|
16
|
+
value => {
|
|
17
|
+
element.style.opacity = value;
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
gui.slider({ name: 'Slider with object binding', obj: position, prop: 'x', min: -30, max: 30 },
|
|
22
|
+
() => {
|
|
23
|
+
element.style.transform = `translateX(${position.x}px)`;
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import GUI from '../../../../src/index';
|
|
2
|
+
|
|
3
|
+
export default function toggle() {
|
|
4
|
+
const element = document.querySelector('#container-toggle .element');
|
|
5
|
+
|
|
6
|
+
const gui = new GUI({
|
|
7
|
+
container: '#container-toggle',
|
|
8
|
+
draggable: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
gui.toggle({ name: 'Toggle', value: true }, state => {
|
|
12
|
+
if ( state ) element.classList.remove('round');
|
|
13
|
+
else element.classList.add('round');
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import GUI from '../../../../src/index';
|
|
2
|
+
|
|
3
|
+
export default function vector2() {
|
|
4
|
+
const position = {
|
|
5
|
+
x: 0,
|
|
6
|
+
y: 0
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const element = document.querySelector('#container-vector2 .element');
|
|
10
|
+
|
|
11
|
+
const gui = new GUI({
|
|
12
|
+
container: '#container-vector2',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
gui.vector2({ name: 'Position',
|
|
16
|
+
x: { obj: position, prop: 'x', min: -50, max: 50 },
|
|
17
|
+
y: { obj: position, prop: 'y', min: -50, max: 50 },
|
|
18
|
+
}, (x, y) => {
|
|
19
|
+
element.style.transform = `translate(${x}px, ${-y}px)`;
|
|
20
|
+
});
|
|
21
|
+
}
|
package/test/src/js/vectors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import GUI from '../../../src/index';
|
|
2
2
|
|
|
3
3
|
export default function vectors() {
|
|
4
|
-
const
|
|
4
|
+
const position = {
|
|
5
5
|
x: 0,
|
|
6
6
|
y: 0
|
|
7
7
|
}
|
|
@@ -13,13 +13,13 @@ export default function vectors() {
|
|
|
13
13
|
container: '#container-vectors',
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
gui.vector2('Position', {
|
|
17
|
-
x: { object:
|
|
18
|
-
y: { object:
|
|
19
|
-
});
|
|
16
|
+
gui.vector2({ name: 'Position', data: {
|
|
17
|
+
x: { object: position, prop: 'x', min: -50, max: 50 },
|
|
18
|
+
y: { object: position, prop: 'y', min: -50, max: 50 },
|
|
19
|
+
}});
|
|
20
20
|
|
|
21
21
|
function loop() {
|
|
22
|
-
element.style.transform = `translate(${
|
|
22
|
+
element.style.transform = `translate(${position.x}px, ${-position.y}px)`;
|
|
23
23
|
requestAnimationFrame(loop);
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.sidebar {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
border-right: 1px solid var(--grey);
|
|
6
|
+
height: 100%;
|
|
7
|
+
background-color: #1b1b1b;
|
|
8
|
+
width: 120px;
|
|
9
|
+
padding: 40px;
|
|
10
|
+
z-index: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.sidebar__title {
|
|
14
|
+
opacity: .8;
|
|
15
|
+
display: block;
|
|
16
|
+
margin-top: 4rem;
|
|
17
|
+
margin-bottom: 2rem;
|
|
18
|
+
font-size: 1.8rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sidebar__item {
|
|
22
|
+
opacity: .8;
|
|
23
|
+
display: block;
|
|
24
|
+
font-size: var(--body-size);
|
|
25
|
+
margin-bottom: 1rem;
|
|
26
|
+
margin-left: 1rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.sidebar__item:hover {
|
|
30
|
+
opacity: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.sidebar__item:first-of-type {
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.sidebar__item:last-of-type {
|
|
38
|
+
margin-bottom: 4rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@media (max-width: 1024px) {
|
|
42
|
+
.sidebar {
|
|
43
|
+
width: 120px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
table {
|
|
2
|
+
width: 100%;
|
|
3
|
+
font-size: 1.4rem;
|
|
4
|
+
color: var(--white);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
th {
|
|
8
|
+
border-bottom: 1px solid var(--grey);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
th, td {
|
|
12
|
+
text-align: left;
|
|
13
|
+
border-right: 1px solid var(--grey);
|
|
14
|
+
padding: 1rem;
|
|
15
|
+
line-height: 1.5;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
th:last-of-type,
|
|
19
|
+
td:last-of-type {
|
|
20
|
+
border-right: none;
|
|
21
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
@import url('https://api.fontshare.com/v2/css?f[]=general-sans@
|
|
1
|
+
@import url('https://api.fontshare.com/v2/css?f[]=general-sans@400,600&display=swap');
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
4
|
--black: rgb(17, 17, 17);
|
|
5
5
|
--white: rgb(246, 246, 232);
|
|
6
6
|
--grey: #ffffff33;
|
|
7
|
+
--green: #06ff89;
|
|
7
8
|
--sans: 'General Sans', serif;
|
|
8
9
|
--h1-size: 2.6rem;
|
|
9
10
|
--h2-size: 2.2rem;
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
* {
|
|
14
15
|
-webkit-font-smoothing: antialiased;
|
|
15
16
|
-moz-osx-font-smoothing: grayscale;
|
|
17
|
+
font-size: 1.5rem;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
html, body {
|
|
@@ -34,47 +36,6 @@ body {
|
|
|
34
36
|
.wrapper {
|
|
35
37
|
display: flex;
|
|
36
38
|
flex-direction: row;
|
|
37
|
-
font-size: 1.2rem;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.sidebar {
|
|
41
|
-
position: fixed;
|
|
42
|
-
top: 0;
|
|
43
|
-
left: 0;
|
|
44
|
-
border-right: 1px solid var(--grey);
|
|
45
|
-
height: 100%;
|
|
46
|
-
background-color: #1b1b1b;
|
|
47
|
-
width: 120px;
|
|
48
|
-
padding: 40px;
|
|
49
|
-
z-index: 1;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.sidebar__title {
|
|
53
|
-
opacity: .8;
|
|
54
|
-
display: block;
|
|
55
|
-
margin-top: 4rem;
|
|
56
|
-
margin-bottom: 2rem;
|
|
57
|
-
font-size: 1.8rem;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.sidebar__item {
|
|
61
|
-
opacity: .8;
|
|
62
|
-
display: block;
|
|
63
|
-
font-size: var(--body-size);
|
|
64
|
-
margin-bottom: 1rem;
|
|
65
|
-
margin-left: 1rem;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.sidebar__item:hover {
|
|
69
|
-
opacity: 1;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.sidebar__item:first-of-type {
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.sidebar__item:last-of-type {
|
|
77
|
-
margin-bottom: 4rem;
|
|
78
39
|
}
|
|
79
40
|
|
|
80
41
|
.main {
|
|
@@ -85,10 +46,6 @@ body {
|
|
|
85
46
|
}
|
|
86
47
|
|
|
87
48
|
@media (max-width: 1024px) {
|
|
88
|
-
.sidebar {
|
|
89
|
-
width: 120px;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
49
|
.main {
|
|
93
50
|
width: 700px;
|
|
94
51
|
padding: 0 20px 100px 230px;
|
|
@@ -103,19 +60,23 @@ body {
|
|
|
103
60
|
|
|
104
61
|
.subtitle {
|
|
105
62
|
opacity: .6;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.subtitle,
|
|
66
|
+
.subtitle span {
|
|
106
67
|
font-size: 1.2rem;
|
|
107
68
|
}
|
|
108
69
|
|
|
109
70
|
.link {
|
|
110
71
|
padding: 10px;
|
|
111
|
-
border-bottom: 1px solid var(--
|
|
72
|
+
border-bottom: 1px solid var(--green);
|
|
112
73
|
margin-left: 20px;
|
|
113
74
|
font-size: var(--body-size);
|
|
114
75
|
}
|
|
115
76
|
|
|
116
77
|
h1, h2 {
|
|
117
78
|
font-family: var(--sans), sans-serif;
|
|
118
|
-
font-weight:
|
|
79
|
+
font-weight: 600;
|
|
119
80
|
}
|
|
120
81
|
|
|
121
82
|
h1 {
|
|
@@ -125,12 +86,12 @@ h1 {
|
|
|
125
86
|
}
|
|
126
87
|
|
|
127
88
|
h2 {
|
|
128
|
-
margin-top:
|
|
89
|
+
margin-top: 110px;
|
|
129
90
|
font-size: var(--h2-size);
|
|
130
91
|
}
|
|
131
92
|
|
|
132
|
-
p {
|
|
133
|
-
line-height: 1.
|
|
93
|
+
p, li {
|
|
94
|
+
line-height: 1.5;
|
|
134
95
|
font-size: var(--body-size);
|
|
135
96
|
}
|
|
136
97
|
|
|
@@ -156,7 +117,7 @@ a {
|
|
|
156
117
|
font-family: monospace;
|
|
157
118
|
background-color: #333333;
|
|
158
119
|
color: #a6e22e;
|
|
159
|
-
padding:
|
|
120
|
+
padding: 1px 6px;
|
|
160
121
|
border-radius: 3px;
|
|
161
122
|
}
|
|
162
123
|
|
|
@@ -167,7 +128,7 @@ div:has(pre) {
|
|
|
167
128
|
pre[class*=language-] {
|
|
168
129
|
padding: 30px;
|
|
169
130
|
border-radius: 5px;
|
|
170
|
-
font-size: 1.
|
|
131
|
+
font-size: 1.5rem;
|
|
171
132
|
}
|
|
172
133
|
|
|
173
134
|
.container {
|
|
@@ -183,6 +144,10 @@ pre[class*=language-] {
|
|
|
183
144
|
border-radius: 5px;
|
|
184
145
|
}
|
|
185
146
|
|
|
147
|
+
.container--small {
|
|
148
|
+
height: 200px;
|
|
149
|
+
}
|
|
150
|
+
|
|
186
151
|
.element {
|
|
187
152
|
width: 100px;
|
|
188
153
|
height: 100px;
|
|
@@ -192,11 +157,18 @@ pre[class*=language-] {
|
|
|
192
157
|
right: 0;
|
|
193
158
|
bottom: 0;
|
|
194
159
|
margin: auto;
|
|
195
|
-
background-color:
|
|
160
|
+
background-color: var(--green);
|
|
196
161
|
background-size: cover;
|
|
197
162
|
background-position: center;
|
|
198
163
|
background-repeat: no-repeat;
|
|
199
164
|
transition: .1s transform ease, .3s border-radius ease;
|
|
165
|
+
border-radius: 3px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.element.left {
|
|
169
|
+
left: calc((50% - 145px) - 50px);
|
|
170
|
+
right: 0px;
|
|
171
|
+
margin: auto 0px;
|
|
200
172
|
}
|
|
201
173
|
|
|
202
174
|
.element.round {
|
package/test/src/js/folders.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import getRandomColor from './getRandomColor';
|
|
2
|
-
import perfectGUI from '../../../src/index';
|
|
3
|
-
|
|
4
|
-
export default function folders() {
|
|
5
|
-
const element = document.querySelector('#container-3 .element');
|
|
6
|
-
|
|
7
|
-
const gui = new perfectGUI({
|
|
8
|
-
name: 'Folders',
|
|
9
|
-
container: '#container-3'
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
let folder_1 = gui.folder({ name: 'Folder 1' });
|
|
13
|
-
|
|
14
|
-
folder_1.button('Random color', () => {
|
|
15
|
-
element.style.backgroundColor = getRandomColor();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
folder_1.slider({ name: 'Size', value: 1 }, value => {
|
|
19
|
-
element.style.transform = `scale(${value})`;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
let folder_2 = gui.folder({ name: 'Folder 2', closed: true });
|
|
23
|
-
|
|
24
|
-
folder_2.button('Random color', () => {
|
|
25
|
-
element.style.backgroundColor = getRandomColor();
|
|
26
|
-
});
|
|
27
|
-
}
|