-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
188 lines (166 loc) · 3.91 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<script type="text/javascript" src="dist/main.js"></script>
</head>
<body>
<img id="spinner" src="assets/spinner.gif"/>
<div id="toolbar">
<div id="row1" style="flex: 0 1 50%">
<div style="display: flex; flex-direction: column; margin: 10px 0;">
<div>
<div>
<label for="strokeType">Choose stroke type: </label>
</div>
<div>
<select name="strokeType" id="strokeType">
<option value="variable">variable</option>
<option value="constant">constant</option>
</select>
</div>
</div>
<div>
<div>
<label for="numOfStrokes">Generate strokes: </label>
</div>
<div>
<input type="number" id="numOfStrokes">
</div>
</div>
<div>
<div>
<label for="engines">Choose rendering engine: </label>
</div>
<div>
<select name="engines" id="engines">
<option value="canvaskit-2d">CanvasKit2D</option>
<option value="canvaskit-webgl">CanvasKitWebGL</option>
<option value="htmlcanvas">HTMLCanvas</option>
</select>
</div>
</div>
</div>
<div>
<div>
<span id="currentStrokeSpan">strokeType: null, strokeNum: 0</span>
</div>
</div>
<div>
<div class="button" id="generateStrokeButton">Generate strokes</div>
<div class="button" id="drawButton">Draw</div>
<div class="button" id="plotButton">Plot results</div>
</div>
<div id="log"></div>
</div>
<div style="align-items: center">
<canvas id="plot" width=600 height=600></canvas>
</div>
</div>
<div id="content">
<div id="canvaskit-container">
CanvasKit - Skia
<span id="canvaskit-result"></span>
<div id="canvaskit-content-container">
<canvas id="canvaskitCanvas" width=600 height=600></canvas>
</div>
</div>
<div id="htmlcanvas-container">
HTMLCanvas
<span id="htmlcanvas-result"></span>
<canvas id="htmlcanvas" width=600 height=600>
</div>
</div>
</body>
<style>
body {
display: flex;
flex-direction: column;
width: 100vw;
height: 100vh;
}
body>div {
padding: 0;
}
#spinner {
display: block;
position: absolute;
z-index: 999;
width: 100vw;
height: 100vh;
}
#toolbar>div {
display: flex;
flex-flow: row;
}
#toolbar {
display: flex;
flex-direction: row;
height: 50vh;
width: 100%;
justify-content: space-evenly;
}
#toolbar>div div {
display: flex;
align-items: start;
}
#toolbar>div>div div {
margin: 10px 0;
}
#content {
display: flex;
flex: 0 1 50%;
}
#canvaskit-container {
width: 50%;
height: 100%;
align-items: center;
justify-content: center;
display: flex;
flex-direction: column;
}
#htmlcanvas-container {
width: 50%;
height: 100%;
align-items: center;
justify-content: center;
display: flex;
flex-direction: column;
}
canvas {
width: 600px;
height: 600px;
}
#canvaskitCanvas, #canvaskitImg {
position: absolute;
}
#canvaskit-content-container {
width: 600px;
height: 600px;
}
#row1 {
flex-direction: column !important;
align-items: flex-start !important;
}
#log {
display: flex;
flex-flow: column !important;
align-items: start !important;
background: #dddddd;
width: 100%;
overflow: scroll;
flex: 0 1 50%;
margin: 0 20px;
}
.button {
background: #eeeeee;
border-width: 1px;
border-radius: 10px;
border-color: black;
border-style: solid;
padding: 10px !important;
margin: 10px !important;
cursor: pointer;
user-select: none;
}
</style>
</html>