]> git.lizzy.rs Git - antifa-generator.git/blob - index.html
Make label configurable
[antifa-generator.git] / index.html
1 <!DOCTYPE html>
2 <html lang="en">
3
4 <head>
5     <meta charset="UTF-8">
6     <meta name="viewport" content="width=device-width, initial-scale=1.0">
7     <script src="dist/circletext.js"></script>
8     <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" rel="stylesheet">
9     <link rel="stylesheet" href="css/styles.css">
10     <link rel="stylesheet" href="css/forms.css">
11     <title>Antifa Generator</title>
12 </head>
13
14 <body>
15     <div class="container">
16         <form>
17             <h1>Antifa Generator</h1>
18             <div class="form-group">
19                 <input id="antifa-group" type="text" required="required" />
20                 <label for="input" class="control-label">Grupo</label><i class="bar"></i>
21             </div>
22             <div class="form-group">
23                 <input id="antifa-label" type="text" required="required" />
24                 <label for="input" class="control-label">Label</label><i class="bar"></i>
25             </div>
26         </form>
27         <div class="button-container">
28             <button type="button" class="button" onClick="generateImage()"><span>Gerar imagem</span></button>
29             <button type="button" class="button" onClick="downloadImage()"><span>Baixar</span></button>
30             <button type="button" class="button"
31                 onclick="window.open('https://medium.com/@matheusMmota/antifascismo-n%C3%A3o-%C3%A9-moldura-para-o-seu-perfil-d648c1b3caa8')"><span>Antifacista?</span></button>
32
33         </div>
34
35
36         <canvas id="logo" height="500" width="500">
37             Seu navegador não suporta canvas
38         </canvas>
39     </div>
40     <script>
41         const button = document.querySelector('.button');
42         const logoCanvas = document.getElementById('logo')
43
44         function generateImage() {
45             antifaGroup = document.getElementById('antifa-group')
46             antifaLabel = document.getElementById('antifa-label')
47
48             ctx = logoCanvas.getContext("2d");
49             const background = new Image();
50             background.src = 'img/antifascist-action.png';
51             background.onload = function () {
52                 ctx.drawImage(background, 0, 0, 500, 500);
53                 writeTopCircle(antifaGroup.value, "logo", 510, "white")
54                 writeBottomCircle(antifaLabel.value, "logo", 510, "white")
55                 logoCanvas.style.display = "flex"
56             }
57         };
58
59         function downloadImage() {
60             const img = logoCanvas.toDataURL("image/png");
61             console.log('img :>> ', img);
62             const link = document.createElement('a');
63             link.href = img;
64             link.download = 'Download.jpg';
65             document.body.appendChild(link);
66             link.click();
67             document.body.removeChild(link);
68         }
69
70
71     </script>
72
73 </body>
74
75 </html>