Complete the presentation in the launcher script.
Chris Pressey
1 year, 5 months ago
5 | 5 |
function launch(config) {
|
6 | 6 |
var div=DAM.maker('div'), button=DAM.maker('button'), canvas=DAM.maker('canvas');
|
7 | 7 |
|
8 | |
var can = canvas({ width: 800, height: 600 });
|
9 | |
var viewport = div({ id: "canvas_viewport" });
|
10 | |
viewport.appendChild(can);
|
11 | |
config.container.appendChild(viewport);
|
|
8 |
var can = canvas({ width: 800, height: 400 });
|
|
9 |
config.container.appendChild(can);
|
12 | 10 |
|
13 | 11 |
var gewgaw = new KolakoskiKurve();
|
14 | 12 |
|
15 | |
var slidersPanel = div({ id: "sliders-panel" });
|
16 | |
config.container.appendChild(slidersPanel);
|
|
13 |
var controlPanel = div(
|
|
14 |
{ id: "control-panel" },
|
|
15 |
div(
|
|
16 |
DAM.makeRange({
|
|
17 |
title: "Segment length:",
|
|
18 |
min: 2,
|
|
19 |
max: 25,
|
|
20 |
value: 5,
|
|
21 |
onchange: function(v) {
|
|
22 |
gewgaw.dist = v;
|
|
23 |
}
|
|
24 |
})
|
|
25 |
),
|
|
26 |
div(
|
|
27 |
DAM.makeRange({
|
|
28 |
title: "Start index:",
|
|
29 |
min: 1,
|
|
30 |
max: 10000,
|
|
31 |
value: 1,
|
|
32 |
onchange: function(v) {
|
|
33 |
gewgaw.startIndex = v - 1;
|
|
34 |
gewgaw.reset();
|
|
35 |
}
|
|
36 |
})
|
|
37 |
),
|
|
38 |
div(
|
|
39 |
DAM.makeRange({
|
|
40 |
title: "End index:",
|
|
41 |
min: 1,
|
|
42 |
max: 10000,
|
|
43 |
value: 10000,
|
|
44 |
onchange: function(v) {
|
|
45 |
gewgaw.endIndex = v - 1;
|
|
46 |
gewgaw.reset();
|
|
47 |
}
|
|
48 |
}),
|
|
49 |
),
|
|
50 |
div(
|
|
51 |
DAM.makeSelect({
|
|
52 |
title: "Draw style:",
|
|
53 |
options: [
|
|
54 |
{
|
|
55 |
text: 'Opaque',
|
|
56 |
value: 'opaque'
|
|
57 |
},
|
|
58 |
{
|
|
59 |
text: 'Translucent',
|
|
60 |
value: 'translucent'
|
|
61 |
},
|
|
62 |
{
|
|
63 |
text: 'XOR',
|
|
64 |
value: 'xor'
|
|
65 |
}
|
|
66 |
],
|
|
67 |
onchange: function(option) {
|
|
68 |
gewgaw.setStyle(option.value);
|
|
69 |
}
|
|
70 |
})
|
|
71 |
),
|
|
72 |
div(
|
|
73 |
button("Reset", {
|
|
74 |
onclick: function() {
|
|
75 |
// this circumlocution is only to avoid weird glitching when resetting 'xor' style.
|
|
76 |
var style = gewgaw.style;
|
|
77 |
gewgaw.setStyle('opaque');
|
|
78 |
gewgaw.setStyle(style);
|
|
79 |
}
|
|
80 |
})
|
|
81 |
)
|
|
82 |
);
|
|
83 |
config.container.appendChild(controlPanel);
|
17 | 84 |
|
18 | 85 |
gewgaw.init({ canvas: can });
|
19 | 86 |
}
|
3 | 3 |
<title>Kolakoski Kurve</title>
|
4 | 4 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5 | 5 |
<style>
|
6 | |
#canvas_viewport {
|
7 | |
width: 100%;
|
8 | |
height: 405px;
|
9 | |
overflow: scroll;
|
10 | |
border: 1px solid blue;
|
|
6 |
canvas { border: 1px solid blue; }
|
|
7 |
#installation {
|
|
8 |
width: 100%;
|
|
9 |
text-align: center;
|
11 | 10 |
}
|
12 | |
textarea {
|
13 | |
width: 100%
|
|
11 |
#control-panel {
|
|
12 |
display: inline-block;
|
|
13 |
width: 50%;
|
|
14 |
text-align: right;
|
14 | 15 |
}
|
15 | 16 |
</style>
|
16 | 17 |
</head>
|