-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
68 lines (63 loc) · 3.52 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image to Dotted pattern</title>
<link rel="stylesheet" href="src/index.css">
</head>
<body>
<div id="app" x-data="appState" class="w-full h-full flex flex-col">
<div class="full-w bg-slate-50 p-2 border-b flex items-center">
<div class="flex-1">
<label><input type="file" accept="image/*" x-on:change="selectImage" class="text-sm text-grey-500
file:mr-5 file:py-3 file:px-10
file:rounded-full file:border-0
file:text-md file:font-semibold file:text-white
file:bg-gradient-to-r file:from-blue-600 file:to-amber-600
hover:file:cursor-pointer hover:file:opacity-80
"></input></label>
</div>
<h1 class="text-lg font-bold flex-1 block text-center">image to dotted pattern</h1>
<div class="flex-1"></div>
</div>
<div id="canvas-container">
<canvas id="canvas" x-ref="canvas" height="0"></canvas>
</div>
<div x-show="!uploaded" class="w-full h-full flex flex-col justify-center items-center">
<div class="mb-4">
<h2 class="text-lg font-bold mb-2">Generate dotted pattern from black and white image</h2>
<p>1. upload black and white image, black area will be converted to evenly spaced dots.</p>
<p>2. adjust dots and colors using the control panel.</p>
<p>3. right click to download the finished image.</p>
</div>
<div class="flex items-center gap-2">
<img src="map.png" width="300" class="border" />
<span> to </span>
<img src="map-dotted.png" width="300" class="border" />
</div>
</div>
<div class="fixed bottom-0 p-2 h-16 border-t bg-slate-50 w-full flex flex-col justify-center">
<p x-show="uploaded" class="w-full text-center">right click generated image to download</p>
<p x-show="!uploaded" class="w-full text-center">only black and white JPG images are supported right now</p>
<p x-show="uploaded" class="w-full text-center font-mono text-sm text-gray-500"
x-text="size.width + 'x' + size.height + ' @ ' + pixelRatio + 'X'"></p>
</div>
<div class="absolute bottom-16 mb-4 left-4 bg-white border rounded p-4 shadow-md" x-data="{submit: false}">
<iframe name="votar" style="display:none;"></iframe>
<form @submit="submit=true" action="https://pb.lingfei.dev/api/collections/signups/records"
enctype="multipart/form-data" method="post" target="votar" class="flex flex-col gap-2 items-start w-64">
<h3 x-show="!submit" class="self-stretch">We love to hear from you:</h3>
<input x-show="!submit" type="email" placeholder="email" name="email" required
class="border rounded p-2 mr-2 self-stretch" />
<input x-show="!submit" type="text" placeholder="questions or ideas" name="inquiry"
class="border rounded p-2 mr-2 self-stretch" />
<button x-show="!submit" type="submit" class="btn btn-blue">submit</button>
<span x-show="submit">Well received!</span>
</form>
</div>
</div>
<div id="dat-gui-container"></div>
<script type="module" src="src/main.js"></script>
</body>
</html>