-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
47 lines (44 loc) · 1.43 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
<head>
<style>
*,
* {
margin: 0;
padding: 0;
overflow: hidden;
}
canvas {
height: 100%;
width: 100%;
}
div {
position: absolute;
top: 50%;
left: 50%;
max-width: 50%;
transform: translateX(-50%) translateY(-50%);
font-size: large;
font-weight: bold;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
</style>
</head>
<body>
<canvas id="canvas" width="300" height="300"></canvas>
<script src="index.js"></script>
<div id="text"></div>
<script>
if (window.location.hash === "") {
window.location.hash = encodeURI(JSON.stringify(defaultConfig));
}
const canvas = document.getElementById("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const context = canvas.getContext('2d');
const textItem = document.getElementById("text");
const drawing = tryParse(window.location.hash);
console.log({ hash: window.location.hash, drawing });
textItem.innerText = drawing.text;
const patternPainter = new PatternPainter(context);
patternPainter.drawPage(drawing);
</script>
</body>