-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
78 lines (66 loc) · 2.83 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="dist/circletext.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/forms.css">
<title>Antifa Generator</title>
</head>
<body>
<div class="container">
<form>
<h1>Antifa Generator</h1>
<div class="form-group">
<input id="antifa-group" type="text" required="required" />
<label for="input" class="control-label">Grupo</label><i class="bar"></i>
</div>
<div class="form-group">
<select id='antifa-label'>
<option>Antifascista</option>
<option>Antifascistas</option>
</select>
<label for="select" class="control-label"></label><i class="bar"></i>
</div>
</form>
<div class="button-container">
<button type="button" class="button" onClick="generateImage()"><span>Gerar imagem</span></button>
<button type="button" class="button" onClick="downloadImage()"><span>Baixar</span></button>
<button type="button" class="button"
onclick="window.open('https://medium.com/@matheusMmota/antifascismo-n%C3%A3o-%C3%A9-moldura-para-o-seu-perfil-d648c1b3caa8')"><span>Antifacista?</span></button>
</div>
<canvas id="logo" height="500" width="500">
Seu navegador não suporta canvas
</canvas>
</div>
<script>
const button = document.querySelector('.button');
const logoCanvas = document.getElementById('logo')
function generateImage() {
antifaGroup = document.getElementById('antifa-group')
antifaLabel = document.getElementById('antifa-label')
ctx = logoCanvas.getContext("2d");
const background = new Image();
background.src = 'img/antifascist-action.png';
background.onload = function () {
ctx.drawImage(background, 0, 0, 500, 500);
writeTopCircle(antifaGroup.value, "logo", 510, "white")
writeBottomCircle(antifaLabel.value, "logo", 510, "white")
logoCanvas.style.display = "flex"
}
};
function downloadImage() {
const img = logoCanvas.toDataURL("image/png");
console.log('img :>> ', img);
const link = document.createElement('a');
link.href = img;
link.download = 'Download.jpg';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
</body>
</html>