-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
208 lines (198 loc) · 7.18 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-rotate=1.0" />
<meta name="description" content="Create and download personalized avatars with AvatarMaker using the DiceBear API.">
<meta name="keywords" content="avatar maker, DiceBear API, create avatar, download avatar, custom avatar, avatar generator">
<meta name="author" content="Stivenm0">
<link rel="shortcut icon" href="./icon.png" type="image/x-icon">
<link rel="stylesheet" href="./bootstrap.css" />
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"
></script>
<script src="//unpkg.com/alpinejs" defer></script>
<title>AvatarMaker</title>
<style>
.h-text{
height: 40px;
}
[x-cloak] { display: none !important; }
</style>
</head>
<body >
<header class="container">
<h1 class="text-center my-2">
<img src="./icon.png" alt="" width="30" >
AvatarMaker
<img src="./icon.png" alt="" width="30" >
</h1>
<p>
Welcome to AvatarMaker! This website utilizes the <a class="badge rounded-pill bg-info" href="https://www.dicebear.com/" target="_blank">DiceBear API</a> to provide you with an easy and fun way to create and download personalized avatars. Whether you need a unique avatar for social media, gaming, or any other purpose, AvatarMaker has you covered.
Created By:<a class="badge rounded-pill bg-secondary" href="https://github.com/estivenm0" target="_blank"> estivenm0</a>
</p>
</header>
<main class="container" x-data="data()" x-cloak>
<section class="row row-cols-md-2 row-cols-1">
<!-- ----COL1----- -->
<div class="col">
<div class="card mb-3">
<h3 class="card-header h-text" x-text="seed" >Name</h3>
<img :src="url" alt="Avatar" width="100%" height="200" />
<div class="card-body">
<!-- ----STYLE---- -->
<div class="mb-2">
<label for="exampleSelect1" class="form-label mb-2"
>Style</label
>
<select class="form-select text-dark" id="exampleSelect1" x-model="style">
<template x-for="style in styles">
<option x-text="style"></option>
</template>
</select>
</div>
<!-- ----NAME---- -->
<div class="d-flex" >
<input
class="form-control "
type="search"
x-model="seed"
placeholder="Name"
/>
</div>
</div>
</div>
</div>
<!-- ----COL2----- -->
<div class="col">
<ul class="list-group list-group-flush">
<!-- ----FLIP---- -->
<li class="list-group-item">
Flip:
<div class="form-check form-switch">
<input
class="form-check-input"
type="checkbox"
x-model="flip"
id="flexSwitchCheckDefault"
/>
<label
class="form-check-label"
for="flexSwitchCheckDefault"
></label>
</div>
</li>
<!-- ----ROTATE---- -->
<li class="list-group-item">
<label for="customRange1" class="form-label"
>Rotate: <span x-text="rotate"></span
></label>
<input
type="range"
class="form-range"
id="customRange1"
step="10"
x-model="rotate"
min="0"
max="360"
/>
</li>
<!-- ----SCALE---- -->
<li class="list-group-item">
<label for="customRange1" class="form-label"
>Scale: <span x-text="scale"></span
></label>
<input
type="range"
class="form-range"
id="customRange1"
step="50"
x-model="scale"
min="50"
max="200"
/>
</li>
<!-- ----COlOR---- -->
<li class="list-group-item">
<label for="customRange1" class="form-label">Background Color:</label>
<input
type="color"
class="form-range"
id="customRange1"
x-model="bg"
/>
</li>
<!-- ----DOWNLOAD---- -->
<li class="list-group-item">
<button class="btn btn-md btn-success container-fluid" x-on:click="download()"
>Download</button>
</li>
</ul>
</div>
</section>
</main>
<script>
function data() {
return {
style: "adventurer",
seed: "",
flip: false,
rotate: 0,
scale: 100,
size: 200,
bg: "",
get url() {
return `https://api.dicebear.com/9.x/${this.style}/svg?seed=+${this.seed}&flip=${this.flip}&rotate=${this.rotate}&scale=${this.scale}&size=${this.size}&backgroundColor=${this.bg.slice(1)}`;
},
styles: [
'adventurer',
'adventurer-neutral',
'avataaars',
'avataaars-neutral',
'big-ears',
'big-ears-neutral',
'big-smile',
'bottts',
'bottts-neutral',
'croodles',
'croodles-neutral',
'fun-emoji',
'icons',
'identicon',
'initials',
'lorelei',
'lorelei-neutral',
'micah',
'miniavs',
'notionists',
'notionists-neutral',
'open-peeps',
'personas',
'pixel-art',
'pixel-art-neutral',
'rings',
'shapes',
'thumbs'
],
download(){
fetch(this.url)
.then(res => res.blob())
.then(blob => {
const link = document.createElement('a');
const url = window.URL.createObjectURL(blob);
link.href = url;
link.download = this.seed;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
})
.catch(err => console.error('Error al descargar la imagen:', err));
}
};
}
</script>
</body>
</html>