git-hash-art 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-it.json +17 -0
- package/README.md +138 -0
- package/bin/generateExamples.js +59 -0
- package/dist/main.js +974 -0
- package/dist/main.js.map +1 -0
- package/eslint.config.mjs +29 -0
- package/examples/angular-1024x1024-f31a6c3e.png +0 -0
- package/examples/banner-1920x480-d847ffd4.png +0 -0
- package/examples/complex-2048x2048-deadbeef.png +0 -0
- package/examples/instagram-square-1080x1080-ff00ff00.png +0 -0
- package/examples/instagram-story-1080x1920-abc123de.png +0 -0
- package/examples/linkedin-banner-1584x396-bbbbbbbb.png +0 -0
- package/examples/minimal-1024x1024-00000000.png +0 -0
- package/examples/phone-wallpaper-1170x2532-ffffffff.png +0 -0
- package/examples/react-1024x1024-46192e59.png +0 -0
- package/examples/tablet-wallpaper-2048x2732-12345678.png +0 -0
- package/examples/twitter-header-1500x500-77777777.png +0 -0
- package/examples/ultrawide-3440x1440-a3e126e5.png +0 -0
- package/package.json +32 -0
- package/src/index.js +226 -0
- package/src/lib/canvas/colors.js +102 -0
- package/src/lib/canvas/draw.js +73 -0
- package/src/lib/canvas/shapes/basic.js +93 -0
- package/src/lib/canvas/shapes/complex.js +205 -0
- package/src/lib/canvas/shapes/index.js +9 -0
- package/src/lib/canvas/shapes/sacred.js +173 -0
- package/src/lib/canvas/shapes/utils.js +37 -0
- package/src/lib/constants.js +138 -0
- package/src/lib/utils.js +59 -0
package/dist/main.js
ADDED
|
@@ -0,0 +1,974 @@
|
|
|
1
|
+
import {createCanvas as $5OpyM$createCanvas} from "canvas";
|
|
2
|
+
import $5OpyM$fs from "fs";
|
|
3
|
+
import $5OpyM$path from "path";
|
|
4
|
+
import $5OpyM$colorscheme from "color-scheme";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const $e982bdf2d46bd221$export$8daab6f91f7ff730 = (ctx, size)=>{
|
|
11
|
+
ctx.beginPath();
|
|
12
|
+
ctx.arc(0, 0, size / 2, 0, Math.PI * 2);
|
|
13
|
+
};
|
|
14
|
+
const $e982bdf2d46bd221$export$9340b6a85ea854b9 = (ctx, size)=>{
|
|
15
|
+
ctx.beginPath();
|
|
16
|
+
ctx.rect(-size / 2, -size / 2, size, size);
|
|
17
|
+
};
|
|
18
|
+
const $e982bdf2d46bd221$export$e6b70c7883316010 = (ctx, size)=>{
|
|
19
|
+
ctx.beginPath();
|
|
20
|
+
ctx.moveTo(0, -size / 2);
|
|
21
|
+
ctx.lineTo(-size / 2, size / 2);
|
|
22
|
+
ctx.lineTo(size / 2, size / 2);
|
|
23
|
+
ctx.closePath();
|
|
24
|
+
};
|
|
25
|
+
const $e982bdf2d46bd221$export$252d2895fb67397b = (ctx, size)=>{
|
|
26
|
+
ctx.beginPath();
|
|
27
|
+
for(let i = 0; i < 6; i++){
|
|
28
|
+
const angle = Math.PI / 8 * i;
|
|
29
|
+
const x = size / 2 * Math.cos(angle);
|
|
30
|
+
const y = size / 2 * Math.sin(angle);
|
|
31
|
+
if (i === 0) ctx.moveTo(x, y);
|
|
32
|
+
else ctx.lineTo(x, y);
|
|
33
|
+
}
|
|
34
|
+
ctx.closePath();
|
|
35
|
+
};
|
|
36
|
+
const $e982bdf2d46bd221$export$ca57b923902a3c0 = (ctx, size)=>{
|
|
37
|
+
ctx.beginPath();
|
|
38
|
+
for(let i = 0; i < 10; i++){
|
|
39
|
+
const angle = Math.PI / 5 + Math.PI / 5 * i * 3;
|
|
40
|
+
const radius = i % 2 === 0 ? size / 2 : size / 4;
|
|
41
|
+
const x = radius * Math.cos(angle);
|
|
42
|
+
const y = radius * Math.sin(angle);
|
|
43
|
+
if (i === 0) ctx.moveTo(x, y);
|
|
44
|
+
else ctx.lineTo(x, y);
|
|
45
|
+
}
|
|
46
|
+
ctx.closePath();
|
|
47
|
+
};
|
|
48
|
+
const $e982bdf2d46bd221$export$cf8f2f05ac4f561f = (ctx, size)=>{
|
|
49
|
+
ctx.beginPath();
|
|
50
|
+
for(let i = 0; i < 10; i++){
|
|
51
|
+
const angle = Math.PI / 30 + Math.PI / 30 * i * 8;
|
|
52
|
+
const radius = i % 2 === 0 ? size / 2 : size / 8;
|
|
53
|
+
const x = radius * Math.cos(angle);
|
|
54
|
+
const y = radius * Math.sin(angle);
|
|
55
|
+
if (i === 0) ctx.moveTo(x, y);
|
|
56
|
+
else ctx.lineTo(x, y);
|
|
57
|
+
}
|
|
58
|
+
ctx.closePath();
|
|
59
|
+
};
|
|
60
|
+
const $e982bdf2d46bd221$export$1ed0c0bc398b6246 = (ctx, size)=>{
|
|
61
|
+
ctx.beginPath();
|
|
62
|
+
ctx.moveTo(0, size / 4);
|
|
63
|
+
ctx.quadraticCurveTo(size / 2, size / 4, 0, -size / 4);
|
|
64
|
+
ctx.quadraticCurveTo(-size / 2, size / 4, 0, size / 4);
|
|
65
|
+
};
|
|
66
|
+
const $e982bdf2d46bd221$export$57ec12daf141ce6 = (ctx, size)=>{
|
|
67
|
+
ctx.beginPath();
|
|
68
|
+
ctx.moveTo(0, -size / 2);
|
|
69
|
+
ctx.lineTo(size / 2, 0);
|
|
70
|
+
ctx.lineTo(0, size / 2);
|
|
71
|
+
ctx.lineTo(-size / 2, 0);
|
|
72
|
+
ctx.closePath();
|
|
73
|
+
};
|
|
74
|
+
const $e982bdf2d46bd221$export$39f25a4fc5491539 = (ctx, size)=>{
|
|
75
|
+
ctx.beginPath();
|
|
76
|
+
ctx.moveTo(-size / 2, -size / 2);
|
|
77
|
+
ctx.lineTo(size / 2, -size / 2);
|
|
78
|
+
ctx.lineTo(size / 2, size / 2);
|
|
79
|
+
ctx.lineTo(-size / 2, size / 2);
|
|
80
|
+
ctx.closePath();
|
|
81
|
+
};
|
|
82
|
+
const $e982bdf2d46bd221$export$492753207a5258e1 = {
|
|
83
|
+
circle: $e982bdf2d46bd221$export$8daab6f91f7ff730,
|
|
84
|
+
square: $e982bdf2d46bd221$export$9340b6a85ea854b9,
|
|
85
|
+
triangle: $e982bdf2d46bd221$export$e6b70c7883316010,
|
|
86
|
+
hexagon: $e982bdf2d46bd221$export$252d2895fb67397b,
|
|
87
|
+
star: $e982bdf2d46bd221$export$ca57b923902a3c0,
|
|
88
|
+
"jacked-star": $e982bdf2d46bd221$export$cf8f2f05ac4f561f,
|
|
89
|
+
heart: $e982bdf2d46bd221$export$1ed0c0bc398b6246,
|
|
90
|
+
diamond: $e982bdf2d46bd221$export$57ec12daf141ce6,
|
|
91
|
+
cube: $e982bdf2d46bd221$export$39f25a4fc5491539
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
const $81d7f9c14b75c186$export$9265403940be6b4 = {
|
|
96
|
+
// Standard sizes with different hashes
|
|
97
|
+
react: {
|
|
98
|
+
hash: "46192e59d42f741c761cbea79462a8b3815dd905",
|
|
99
|
+
width: 1024,
|
|
100
|
+
height: 1024
|
|
101
|
+
},
|
|
102
|
+
angular: {
|
|
103
|
+
hash: "f31a6c3e94420f43c0cd323a5a6a99376ee59ff8",
|
|
104
|
+
width: 1024,
|
|
105
|
+
height: 1024,
|
|
106
|
+
gridSize: 6
|
|
107
|
+
},
|
|
108
|
+
// Wide format variations
|
|
109
|
+
banner: {
|
|
110
|
+
hash: "d847ffd4269b22c54d6e85ad3c1892a298e961fb",
|
|
111
|
+
width: 1920,
|
|
112
|
+
height: 480,
|
|
113
|
+
gridSize: 8,
|
|
114
|
+
shapesPerLayer: 40
|
|
115
|
+
},
|
|
116
|
+
ultrawide: {
|
|
117
|
+
hash: "a3e126e537ed2cd11ddf3a96c37066e97c7afee6",
|
|
118
|
+
width: 3440,
|
|
119
|
+
height: 1440,
|
|
120
|
+
gridSize: 12,
|
|
121
|
+
shapesPerLayer: 60
|
|
122
|
+
},
|
|
123
|
+
// Social media sizes
|
|
124
|
+
"instagram-square": {
|
|
125
|
+
hash: "ff00ff00ff00ff00ff00ff00ff00ff00ff00ff0",
|
|
126
|
+
width: 1080,
|
|
127
|
+
height: 1080
|
|
128
|
+
},
|
|
129
|
+
"instagram-story": {
|
|
130
|
+
hash: "abc123def456abc123def456abc123def456abc1",
|
|
131
|
+
width: 1080,
|
|
132
|
+
height: 1920,
|
|
133
|
+
gridSize: 6,
|
|
134
|
+
layers: 6
|
|
135
|
+
},
|
|
136
|
+
"twitter-header": {
|
|
137
|
+
hash: "7777777777777777777777777777777777777777",
|
|
138
|
+
width: 1500,
|
|
139
|
+
height: 500,
|
|
140
|
+
gridSize: 8,
|
|
141
|
+
shapesPerLayer: 35
|
|
142
|
+
},
|
|
143
|
+
"linkedin-banner": {
|
|
144
|
+
hash: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
145
|
+
width: 1584,
|
|
146
|
+
height: 396,
|
|
147
|
+
gridSize: 8,
|
|
148
|
+
shapesPerLayer: 35
|
|
149
|
+
},
|
|
150
|
+
// Mobile sizes
|
|
151
|
+
"phone-wallpaper": {
|
|
152
|
+
hash: "ffffffffffffffffffffffffffffffffaaaaaaaa",
|
|
153
|
+
width: 1170,
|
|
154
|
+
height: 2532,
|
|
155
|
+
gridSize: 5,
|
|
156
|
+
layers: 6
|
|
157
|
+
},
|
|
158
|
+
"tablet-wallpaper": {
|
|
159
|
+
hash: "123456789abcdef0123456789abcdef012345678",
|
|
160
|
+
width: 2048,
|
|
161
|
+
height: 2732,
|
|
162
|
+
gridSize: 7,
|
|
163
|
+
layers: 6
|
|
164
|
+
},
|
|
165
|
+
// Special configurations
|
|
166
|
+
minimal: {
|
|
167
|
+
hash: "000000000000000000000000000000000fffffff",
|
|
168
|
+
width: 1024,
|
|
169
|
+
height: 1024,
|
|
170
|
+
layers: 3,
|
|
171
|
+
baseOpacity: 0.8,
|
|
172
|
+
shapesPerLayer: 15
|
|
173
|
+
},
|
|
174
|
+
complex: {
|
|
175
|
+
hash: "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
|
|
176
|
+
width: 2048,
|
|
177
|
+
height: 2048,
|
|
178
|
+
gridSize: 8,
|
|
179
|
+
layers: 7,
|
|
180
|
+
shapesPerLayer: 50,
|
|
181
|
+
minShapeSize: 30,
|
|
182
|
+
maxShapeSize: 250
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const $81d7f9c14b75c186$export$3572305709b6b48c = {
|
|
186
|
+
strokeStyle: "#000000",
|
|
187
|
+
fillStyle: "transparent",
|
|
188
|
+
lineWidth: 1,
|
|
189
|
+
rotation: 0,
|
|
190
|
+
iterations: 1,
|
|
191
|
+
animate: false
|
|
192
|
+
};
|
|
193
|
+
const $81d7f9c14b75c186$export$a4ca1369b6d2c19e = {
|
|
194
|
+
BASIC: "basic",
|
|
195
|
+
DETAILED: "detailed",
|
|
196
|
+
ANIMATED: "animated"
|
|
197
|
+
};
|
|
198
|
+
const $81d7f9c14b75c186$export$bb9e4790bc99ae59 = {
|
|
199
|
+
GOLDEN_RATIO: 1.618034,
|
|
200
|
+
SQUARE_ROOT_2: Math.sqrt(2),
|
|
201
|
+
SQUARE_ROOT_3: Math.sqrt(3),
|
|
202
|
+
SQUARE_ROOT_5: Math.sqrt(5),
|
|
203
|
+
PI: Math.PI,
|
|
204
|
+
PHI: (1 + Math.sqrt(5)) / 2
|
|
205
|
+
};
|
|
206
|
+
const $81d7f9c14b75c186$export$c36defeab44ba3b3 = {
|
|
207
|
+
flowerOfLifeMandala: (size)=>[
|
|
208
|
+
// { type: "flowerOfLife", config: { size } },
|
|
209
|
+
{
|
|
210
|
+
type: "merkaba",
|
|
211
|
+
config: {
|
|
212
|
+
size: size * 0.8
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
type: "sriYantra",
|
|
217
|
+
config: {
|
|
218
|
+
size: size * 0.5
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
platonicProgression: (size)=>[
|
|
223
|
+
{
|
|
224
|
+
type: "platonicSolid",
|
|
225
|
+
config: {
|
|
226
|
+
size: size,
|
|
227
|
+
type: "tetrahedron"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
type: "platonicSolid",
|
|
232
|
+
config: {
|
|
233
|
+
size: size * 0.8,
|
|
234
|
+
type: "cube"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
type: "platonicSolid",
|
|
239
|
+
config: {
|
|
240
|
+
size: size * 0.6,
|
|
241
|
+
type: "octahedron"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
cosmicTree: (size)=>[
|
|
246
|
+
// { type: "treeOfLife", config: { size } },
|
|
247
|
+
{
|
|
248
|
+
type: "fibonacciSpiral",
|
|
249
|
+
config: {
|
|
250
|
+
size: size * 0.9
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
type: "metatronsCube",
|
|
255
|
+
config: {
|
|
256
|
+
size: size * 0.7
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
const $3607eda4304ea847$export$e6bfdeff8bfc94f9 = (degrees)=>degrees * Math.PI / 180;
|
|
264
|
+
const $3607eda4304ea847$export$e46c5570db033611 = (ctx, size, config)=>{
|
|
265
|
+
ctx.save();
|
|
266
|
+
ctx.translate(0, 0);
|
|
267
|
+
if (config.rotation) ctx.rotate($3607eda4304ea847$export$e6bfdeff8bfc94f9(config.rotation));
|
|
268
|
+
ctx.lineWidth = config.lineWidth;
|
|
269
|
+
ctx.strokeStyle = config.strokeStyle;
|
|
270
|
+
ctx.fillStyle = config.fillStyle;
|
|
271
|
+
};
|
|
272
|
+
const $3607eda4304ea847$export$68ae68d395d27fd1 = (ctx)=>{
|
|
273
|
+
ctx.restore();
|
|
274
|
+
};
|
|
275
|
+
const $3607eda4304ea847$export$70ba51ca253810ef = (type)=>({
|
|
276
|
+
enabled: false,
|
|
277
|
+
duration: 1000,
|
|
278
|
+
easing: "linear",
|
|
279
|
+
type: type
|
|
280
|
+
});
|
|
281
|
+
const $3607eda4304ea847$export$5627764dc1e1d74a = (cx, cy, radius, segments)=>{
|
|
282
|
+
const points = [];
|
|
283
|
+
for(let i = 0; i < segments; i++){
|
|
284
|
+
const angle = i / segments * Math.PI * 2;
|
|
285
|
+
points.push({
|
|
286
|
+
x: cx + Math.cos(angle) * radius,
|
|
287
|
+
y: cy + Math.sin(angle) * radius
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
return points;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
const $6768203c11c08d59$export$90cc629a1c6121c7 = {
|
|
295
|
+
platonic: {
|
|
296
|
+
tetrahedron: {
|
|
297
|
+
vertices: 4,
|
|
298
|
+
faces: 4
|
|
299
|
+
},
|
|
300
|
+
cube: {
|
|
301
|
+
vertices: 8,
|
|
302
|
+
faces: 6
|
|
303
|
+
},
|
|
304
|
+
octahedron: {
|
|
305
|
+
vertices: 6,
|
|
306
|
+
faces: 8
|
|
307
|
+
},
|
|
308
|
+
dodecahedron: {
|
|
309
|
+
vertices: 20,
|
|
310
|
+
faces: 12
|
|
311
|
+
},
|
|
312
|
+
icosahedron: {
|
|
313
|
+
vertices: 12,
|
|
314
|
+
faces: 20
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
fibonacci: {
|
|
318
|
+
iterations: 13,
|
|
319
|
+
growthFactor: 1.618034
|
|
320
|
+
},
|
|
321
|
+
goldenRatio: {
|
|
322
|
+
iterations: 8,
|
|
323
|
+
ratio: 1.618034
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
const $6768203c11c08d59$export$4721fcae39954914 = (ctx, size, type, config = {})=>{
|
|
327
|
+
const finalConfig = {
|
|
328
|
+
...(0, $81d7f9c14b75c186$export$3572305709b6b48c),
|
|
329
|
+
...config
|
|
330
|
+
};
|
|
331
|
+
(0, $3607eda4304ea847$export$e46c5570db033611)(ctx, size, finalConfig);
|
|
332
|
+
const { vertices: vertices } = $6768203c11c08d59$export$90cc629a1c6121c7.platonic[type];
|
|
333
|
+
const radius = size / 2;
|
|
334
|
+
// Calculate vertices based on platonic solid type
|
|
335
|
+
const points = (0, $3607eda4304ea847$export$5627764dc1e1d74a)(0, 0, radius, vertices);
|
|
336
|
+
ctx.beginPath();
|
|
337
|
+
// Draw edges between vertices
|
|
338
|
+
points.forEach((p1, i)=>{
|
|
339
|
+
points.slice(i + 1).forEach((p2)=>{
|
|
340
|
+
ctx.moveTo(p1.x, p1.y);
|
|
341
|
+
ctx.lineTo(p2.x, p2.y);
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
if (finalConfig.fillStyle !== "transparent") ctx.fill();
|
|
345
|
+
ctx.stroke();
|
|
346
|
+
(0, $3607eda4304ea847$export$68ae68d395d27fd1)(ctx);
|
|
347
|
+
};
|
|
348
|
+
const $6768203c11c08d59$export$4091fa94ab006097 = (ctx, size, config = {})=>{
|
|
349
|
+
const finalConfig = {
|
|
350
|
+
...(0, $81d7f9c14b75c186$export$3572305709b6b48c),
|
|
351
|
+
...$6768203c11c08d59$export$90cc629a1c6121c7.fibonacci,
|
|
352
|
+
...config
|
|
353
|
+
};
|
|
354
|
+
(0, $3607eda4304ea847$export$e46c5570db033611)(ctx, size, finalConfig);
|
|
355
|
+
let current = 1;
|
|
356
|
+
let previous = 1;
|
|
357
|
+
let scale = size / Math.pow(finalConfig.growthFactor, finalConfig.iterations);
|
|
358
|
+
ctx.beginPath();
|
|
359
|
+
for(let i = 0; i < finalConfig.iterations; i++){
|
|
360
|
+
const radius = scale * current;
|
|
361
|
+
const centerX = radius / 2;
|
|
362
|
+
const centerY = radius / 2;
|
|
363
|
+
ctx.arc(centerX, centerY, radius, Math.PI, Math.PI * 1.5);
|
|
364
|
+
// Calculate next Fibonacci number
|
|
365
|
+
const next = current + previous;
|
|
366
|
+
previous = current;
|
|
367
|
+
current = next;
|
|
368
|
+
// Transform for next iteration
|
|
369
|
+
ctx.translate(radius, 0);
|
|
370
|
+
ctx.rotate(Math.PI / 2);
|
|
371
|
+
}
|
|
372
|
+
ctx.stroke();
|
|
373
|
+
(0, $3607eda4304ea847$export$68ae68d395d27fd1)(ctx);
|
|
374
|
+
};
|
|
375
|
+
const $6768203c11c08d59$export$c9043b89bcb14ed9 = (ctx, size, config = {})=>{
|
|
376
|
+
const finalConfig = {
|
|
377
|
+
...(0, $81d7f9c14b75c186$export$3572305709b6b48c),
|
|
378
|
+
...config
|
|
379
|
+
};
|
|
380
|
+
(0, $3607eda4304ea847$export$e46c5570db033611)(ctx, size, finalConfig);
|
|
381
|
+
const gridSize = 8;
|
|
382
|
+
const unit = size / gridSize;
|
|
383
|
+
ctx.beginPath();
|
|
384
|
+
// Create base grid
|
|
385
|
+
for(let i = 0; i <= gridSize; i++)for(let j = 0; j <= gridSize; j++){
|
|
386
|
+
const x = (i - gridSize / 2) * unit;
|
|
387
|
+
const y = (j - gridSize / 2) * unit;
|
|
388
|
+
// Draw star pattern at each intersection
|
|
389
|
+
const radius = unit / 2;
|
|
390
|
+
for(let k = 0; k < 8; k++){
|
|
391
|
+
const angle = k / 8 * Math.PI * 2;
|
|
392
|
+
const x1 = x + Math.cos(angle) * radius;
|
|
393
|
+
const y1 = y + Math.sin(angle) * radius;
|
|
394
|
+
if (k === 0) ctx.moveTo(x1, y1);
|
|
395
|
+
else ctx.lineTo(x1, y1);
|
|
396
|
+
}
|
|
397
|
+
ctx.closePath();
|
|
398
|
+
}
|
|
399
|
+
if (finalConfig.fillStyle !== "transparent") ctx.fill();
|
|
400
|
+
ctx.stroke();
|
|
401
|
+
(0, $3607eda4304ea847$export$68ae68d395d27fd1)(ctx);
|
|
402
|
+
};
|
|
403
|
+
const $6768203c11c08d59$export$16ea6f9310920305 = (ctx, size, config = {})=>{
|
|
404
|
+
const finalConfig = {
|
|
405
|
+
...(0, $81d7f9c14b75c186$export$3572305709b6b48c),
|
|
406
|
+
...config
|
|
407
|
+
};
|
|
408
|
+
(0, $3607eda4304ea847$export$e46c5570db033611)(ctx, size, finalConfig);
|
|
409
|
+
const gridSize = 4;
|
|
410
|
+
const unit = size / gridSize;
|
|
411
|
+
const drawKnotSegment = (x, y, type)=>{
|
|
412
|
+
ctx.beginPath();
|
|
413
|
+
switch(type){
|
|
414
|
+
case "over":
|
|
415
|
+
ctx.moveTo(x, y);
|
|
416
|
+
ctx.bezierCurveTo(x + unit / 2, y, x + unit / 2, y + unit, x + unit, y + unit);
|
|
417
|
+
break;
|
|
418
|
+
case "under":
|
|
419
|
+
ctx.moveTo(x, y + unit);
|
|
420
|
+
ctx.bezierCurveTo(x + unit / 2, y + unit, x + unit / 2, y, x + unit, y);
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
ctx.stroke();
|
|
424
|
+
};
|
|
425
|
+
// Create knot pattern
|
|
426
|
+
for(let i = 0; i < gridSize; i++)for(let j = 0; j < gridSize; j++){
|
|
427
|
+
const x = (i - gridSize / 2) * unit;
|
|
428
|
+
const y = (j - gridSize / 2) * unit;
|
|
429
|
+
drawKnotSegment(x, y, (i + j) % 2 === 0 ? "over" : "under");
|
|
430
|
+
}
|
|
431
|
+
(0, $3607eda4304ea847$export$68ae68d395d27fd1)(ctx);
|
|
432
|
+
};
|
|
433
|
+
const $6768203c11c08d59$export$661ad3ddfb8912ed = (ctx, size, config = {})=>{
|
|
434
|
+
const finalConfig = {
|
|
435
|
+
...(0, $81d7f9c14b75c186$export$3572305709b6b48c),
|
|
436
|
+
...config
|
|
437
|
+
};
|
|
438
|
+
(0, $3607eda4304ea847$export$e46c5570db033611)(ctx, size, finalConfig);
|
|
439
|
+
const radius = size / 2;
|
|
440
|
+
// Draw two intersecting tetrahedra
|
|
441
|
+
ctx.beginPath();
|
|
442
|
+
// First tetrahedron
|
|
443
|
+
const points1 = (0, $3607eda4304ea847$export$5627764dc1e1d74a)(0, 0, radius, 3);
|
|
444
|
+
points1.forEach((p1, i)=>{
|
|
445
|
+
points1.slice(i + 1).forEach((p2)=>{
|
|
446
|
+
ctx.moveTo(p1.x, p1.y);
|
|
447
|
+
ctx.lineTo(p2.x, p2.y);
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
// Second tetrahedron (rotated)
|
|
451
|
+
ctx.rotate(Math.PI / 6);
|
|
452
|
+
const points2 = (0, $3607eda4304ea847$export$5627764dc1e1d74a)(0, 0, radius, 3);
|
|
453
|
+
points2.forEach((p1, i)=>{
|
|
454
|
+
points2.slice(i + 1).forEach((p2)=>{
|
|
455
|
+
ctx.moveTo(p1.x, p1.y);
|
|
456
|
+
ctx.lineTo(p2.x, p2.y);
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
if (finalConfig.fillStyle !== "transparent") ctx.fill();
|
|
460
|
+
ctx.stroke();
|
|
461
|
+
(0, $3607eda4304ea847$export$68ae68d395d27fd1)(ctx);
|
|
462
|
+
};
|
|
463
|
+
const $6768203c11c08d59$export$dbe318a13ce51887 = {
|
|
464
|
+
platonicSolid: (ctx, size, type = "tetrahedron", config)=>$6768203c11c08d59$export$4721fcae39954914(ctx, size, type, config),
|
|
465
|
+
fibonacciSpiral: (ctx, size, config)=>$6768203c11c08d59$export$4091fa94ab006097(ctx, size, config),
|
|
466
|
+
islamicPattern: (ctx, size, config)=>$6768203c11c08d59$export$c9043b89bcb14ed9(ctx, size, config),
|
|
467
|
+
celticKnot: (ctx, size, config)=>$6768203c11c08d59$export$16ea6f9310920305(ctx, size, config),
|
|
468
|
+
merkaba: (ctx, size, config)=>$6768203c11c08d59$export$661ad3ddfb8912ed(ctx, size, config)
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
const $4191f40726a1f4db$export$3bac12a72d9de58c = (ctx, size)=>{
|
|
474
|
+
const radius = size / 6;
|
|
475
|
+
const centers = [
|
|
476
|
+
{
|
|
477
|
+
x: 0,
|
|
478
|
+
y: 0
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
x: radius * Math.sqrt(3),
|
|
482
|
+
y: 0
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
x: radius * Math.sqrt(3) / 2,
|
|
486
|
+
y: 1.5 * radius
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
x: -radius * Math.sqrt(3) / 2,
|
|
490
|
+
y: 1.5 * radius
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
x: -radius * Math.sqrt(3),
|
|
494
|
+
y: 0
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
x: -radius * Math.sqrt(3) / 2,
|
|
498
|
+
y: -1.5 * radius
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
x: radius * Math.sqrt(3) / 2,
|
|
502
|
+
y: -1.5 * radius
|
|
503
|
+
}
|
|
504
|
+
];
|
|
505
|
+
ctx.beginPath();
|
|
506
|
+
centers.forEach((center)=>{
|
|
507
|
+
ctx.moveTo(center.x + radius, center.y);
|
|
508
|
+
ctx.arc(center.x, center.y, radius, 0, Math.PI * 2);
|
|
509
|
+
});
|
|
510
|
+
};
|
|
511
|
+
const $4191f40726a1f4db$export$639bf214428ceec2 = (ctx, size)=>{
|
|
512
|
+
const radius = size / 12;
|
|
513
|
+
const spacing = radius * 2.5;
|
|
514
|
+
// Sephirot positions (traditional layout)
|
|
515
|
+
const positions = [
|
|
516
|
+
{
|
|
517
|
+
x: 0,
|
|
518
|
+
y: -spacing * 2
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
x: -spacing,
|
|
522
|
+
y: -spacing
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
x: spacing,
|
|
526
|
+
y: -spacing
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
x: -spacing,
|
|
530
|
+
y: 0
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
x: spacing,
|
|
534
|
+
y: 0
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
x: 0,
|
|
538
|
+
y: 0
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
x: -spacing,
|
|
542
|
+
y: spacing
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
x: spacing,
|
|
546
|
+
y: spacing
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
x: 0,
|
|
550
|
+
y: spacing * 2
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
x: 0,
|
|
554
|
+
y: spacing * 3
|
|
555
|
+
} // Malkuth
|
|
556
|
+
];
|
|
557
|
+
// Draw circles
|
|
558
|
+
ctx.beginPath();
|
|
559
|
+
positions.forEach((pos)=>{
|
|
560
|
+
ctx.moveTo(pos.x + radius, pos.y);
|
|
561
|
+
ctx.arc(pos.x, pos.y, radius, 0, Math.PI * 2);
|
|
562
|
+
});
|
|
563
|
+
// Draw connecting lines
|
|
564
|
+
ctx.moveTo(positions[0].x, positions[0].y);
|
|
565
|
+
positions.forEach((pos, i)=>{
|
|
566
|
+
if (i > 0) positions.slice(i + 1).forEach((nextPos)=>{
|
|
567
|
+
ctx.moveTo(pos.x, pos.y);
|
|
568
|
+
ctx.lineTo(nextPos.x, nextPos.y);
|
|
569
|
+
});
|
|
570
|
+
});
|
|
571
|
+
};
|
|
572
|
+
const $4191f40726a1f4db$export$de26673ceb3e04eb = (ctx, size)=>{
|
|
573
|
+
const radius = size / 3;
|
|
574
|
+
// Create 13 points - one center and 12 vertices of an icosahedron
|
|
575
|
+
// const phi = (1 + Math.sqrt(5)) / 2; // Golden ratio
|
|
576
|
+
const vertices = [
|
|
577
|
+
{
|
|
578
|
+
x: 0,
|
|
579
|
+
y: 0
|
|
580
|
+
},
|
|
581
|
+
...(0, $3607eda4304ea847$export$5627764dc1e1d74a)(0, 0, radius, 6),
|
|
582
|
+
...(0, $3607eda4304ea847$export$5627764dc1e1d74a)(0, 0, radius * 1.5, 6) // Outer hexagon
|
|
583
|
+
];
|
|
584
|
+
ctx.beginPath();
|
|
585
|
+
// Draw all connecting lines
|
|
586
|
+
vertices.forEach((v1, i)=>{
|
|
587
|
+
vertices.slice(i + 1).forEach((v2)=>{
|
|
588
|
+
ctx.moveTo(v1.x, v1.y);
|
|
589
|
+
ctx.lineTo(v2.x, v2.y);
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
};
|
|
593
|
+
const $4191f40726a1f4db$export$f743702d1590aefb = (ctx, size)=>{
|
|
594
|
+
const radius = size / 2;
|
|
595
|
+
ctx.beginPath();
|
|
596
|
+
// Draw outer triangles
|
|
597
|
+
for(let i = 0; i < 9; i++){
|
|
598
|
+
const angle = i / 9 * Math.PI * 2;
|
|
599
|
+
const x1 = Math.cos(angle) * radius;
|
|
600
|
+
const y1 = Math.sin(angle) * radius;
|
|
601
|
+
const x2 = Math.cos(angle + Math.PI / 9) * radius;
|
|
602
|
+
const y2 = Math.sin(angle + Math.PI / 9) * radius;
|
|
603
|
+
ctx.moveTo(0, 0);
|
|
604
|
+
ctx.lineTo(x1, y1);
|
|
605
|
+
ctx.lineTo(x2, y2);
|
|
606
|
+
ctx.lineTo(0, 0);
|
|
607
|
+
}
|
|
608
|
+
// Draw inner triangles
|
|
609
|
+
const innerRadius = radius * 0.6;
|
|
610
|
+
for(let i = 0; i < 9; i++){
|
|
611
|
+
const angle = i / 9 * Math.PI * 2 + Math.PI / 18;
|
|
612
|
+
const x1 = Math.cos(angle) * innerRadius;
|
|
613
|
+
const y1 = Math.sin(angle) * innerRadius;
|
|
614
|
+
const x2 = Math.cos(angle + Math.PI / 9) * innerRadius;
|
|
615
|
+
const y2 = Math.sin(angle + Math.PI / 9) * innerRadius;
|
|
616
|
+
ctx.moveTo(0, 0);
|
|
617
|
+
ctx.lineTo(x1, y1);
|
|
618
|
+
ctx.lineTo(x2, y2);
|
|
619
|
+
ctx.lineTo(0, 0);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
const $4191f40726a1f4db$export$980631444e370ab0 = (ctx, size)=>{
|
|
623
|
+
const radius = size / 4;
|
|
624
|
+
const centers = [
|
|
625
|
+
{
|
|
626
|
+
x: 0,
|
|
627
|
+
y: 0
|
|
628
|
+
},
|
|
629
|
+
...(0, $3607eda4304ea847$export$5627764dc1e1d74a)(0, 0, radius * 2, 6)
|
|
630
|
+
];
|
|
631
|
+
ctx.beginPath();
|
|
632
|
+
centers.forEach((center)=>{
|
|
633
|
+
ctx.moveTo(center.x + radius, center.y);
|
|
634
|
+
ctx.arc(center.x, center.y, radius, 0, Math.PI * 2);
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
const $4191f40726a1f4db$export$eeae7765f05012e2 = (ctx, size)=>{
|
|
638
|
+
const radius = size / 3;
|
|
639
|
+
ctx.beginPath();
|
|
640
|
+
// Draw two overlapping circles
|
|
641
|
+
ctx.arc(-radius / 2, 0, radius, 0, Math.PI * 2);
|
|
642
|
+
ctx.arc(radius / 2, 0, radius, 0, Math.PI * 2);
|
|
643
|
+
};
|
|
644
|
+
const $4191f40726a1f4db$export$3355220a8108efc3 = (ctx, size)=>{
|
|
645
|
+
const outerRadius = size / 2;
|
|
646
|
+
const innerRadius = size / 4;
|
|
647
|
+
const steps = 36;
|
|
648
|
+
ctx.beginPath();
|
|
649
|
+
for(let i = 0; i < steps; i++){
|
|
650
|
+
const angle1 = i / steps * Math.PI * 2;
|
|
651
|
+
// const angle2 = ((i + 1) / steps) * Math.PI * 2;
|
|
652
|
+
for(let j = 0; j < steps; j++){
|
|
653
|
+
const phi1 = j / steps * Math.PI * 2;
|
|
654
|
+
const phi2 = (j + 1) / steps * Math.PI * 2;
|
|
655
|
+
const x1 = (outerRadius + innerRadius * Math.cos(phi1)) * Math.cos(angle1);
|
|
656
|
+
const y1 = (outerRadius + innerRadius * Math.cos(phi1)) * Math.sin(angle1);
|
|
657
|
+
const x2 = (outerRadius + innerRadius * Math.cos(phi2)) * Math.cos(angle1);
|
|
658
|
+
const y2 = (outerRadius + innerRadius * Math.cos(phi2)) * Math.sin(angle1);
|
|
659
|
+
ctx.moveTo(x1, y1);
|
|
660
|
+
ctx.lineTo(x2, y2);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
const $4191f40726a1f4db$export$c2fc138f94dd4b2a = {
|
|
665
|
+
// flowerOfLife: drawFlowerOfLife,
|
|
666
|
+
// treeOfLife: drawTreeOfLife,
|
|
667
|
+
metatronsCube: $4191f40726a1f4db$export$de26673ceb3e04eb,
|
|
668
|
+
sriYantra: $4191f40726a1f4db$export$f743702d1590aefb,
|
|
669
|
+
seedOfLife: $4191f40726a1f4db$export$980631444e370ab0,
|
|
670
|
+
vesicaPiscis: $4191f40726a1f4db$export$eeae7765f05012e2,
|
|
671
|
+
torus: $4191f40726a1f4db$export$3355220a8108efc3
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
const $0ced3eed8c5c8e0b$export$4ff7fc6f1af248b5 = {
|
|
676
|
+
...(0, $e982bdf2d46bd221$export$492753207a5258e1),
|
|
677
|
+
...(0, $6768203c11c08d59$export$dbe318a13ce51887),
|
|
678
|
+
...(0, $4191f40726a1f4db$export$c2fc138f94dd4b2a)
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
function $7f8638f37c57b389$export$39a95c82b20fdf81(gitHash) {
|
|
683
|
+
return parseInt(gitHash.slice(0, 8), 16);
|
|
684
|
+
}
|
|
685
|
+
function $7f8638f37c57b389$export$6b193cae730c547a(hash, index, min, max) {
|
|
686
|
+
const hexPair = hash.substr(index * 2 % hash.length, 2);
|
|
687
|
+
const decimal = parseInt(hexPair, 16);
|
|
688
|
+
return min + decimal / 255 * (max - min);
|
|
689
|
+
}
|
|
690
|
+
const $7f8638f37c57b389$export$bb9e4790bc99ae59 = {
|
|
691
|
+
GOLDEN_RATIO: 1.618034,
|
|
692
|
+
SQUARE_ROOT_2: Math.sqrt(2),
|
|
693
|
+
SQUARE_ROOT_3: Math.sqrt(3),
|
|
694
|
+
SQUARE_ROOT_5: Math.sqrt(5),
|
|
695
|
+
PI: Math.PI,
|
|
696
|
+
PHI: (1 + Math.sqrt(5)) / 2
|
|
697
|
+
};
|
|
698
|
+
class $7f8638f37c57b389$export$da2372f11bc66b3f {
|
|
699
|
+
static getProportionalSize(baseSize, proportion) {
|
|
700
|
+
return baseSize * proportion;
|
|
701
|
+
}
|
|
702
|
+
static centerPattern(ctx, width, height) {
|
|
703
|
+
ctx.translate(width / 2, height / 2);
|
|
704
|
+
}
|
|
705
|
+
// Combines sacred geometry patterns with proper proportions
|
|
706
|
+
static layerPatterns(ctx, patterns, config) {
|
|
707
|
+
const { baseSize: baseSize, baseOpacity: baseOpacity = 0.6, opacityReduction: opacityReduction = 0.1, rotationOffset: rotationOffset = 0, proportionType: proportionType = "GOLDEN_RATIO" } = config;
|
|
708
|
+
patterns.forEach((pattern, index)=>{
|
|
709
|
+
const size = this.getProportionalSize(baseSize, Math.pow($7f8638f37c57b389$export$bb9e4790bc99ae59[proportionType], index));
|
|
710
|
+
const opacity = Math.max(0.1, baseOpacity - index * opacityReduction);
|
|
711
|
+
const rotation = rotationOffset * index;
|
|
712
|
+
ctx.save();
|
|
713
|
+
ctx.globalAlpha = opacity;
|
|
714
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
715
|
+
(0, $0ced3eed8c5c8e0b$export$4ff7fc6f1af248b5)[pattern.type](ctx, size, pattern.config);
|
|
716
|
+
ctx.restore();
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
function $8f4da37788745c0d$export$f116a24fd288e742(gitHash) {
|
|
723
|
+
const seed = (0, $7f8638f37c57b389$export$39a95c82b20fdf81)(gitHash);
|
|
724
|
+
const scheme = new (0, $5OpyM$colorscheme)();
|
|
725
|
+
scheme.from_hue(seed % 360).scheme("analogic").variation("soft");
|
|
726
|
+
let colors = scheme.colors().map((hex)=>`#${hex}`);
|
|
727
|
+
const contrastingHue = (seed + 180) % 360;
|
|
728
|
+
const contrastingScheme = new (0, $5OpyM$colorscheme)();
|
|
729
|
+
contrastingScheme.from_hue(contrastingHue).scheme("mono").variation("soft");
|
|
730
|
+
colors.push(`#${contrastingScheme.colors()[0]}`);
|
|
731
|
+
return colors;
|
|
732
|
+
}
|
|
733
|
+
class $8f4da37788745c0d$export$ab958c550f521376 {
|
|
734
|
+
constructor(gitHash){
|
|
735
|
+
this.seed = this.gitHashToSeed(gitHash);
|
|
736
|
+
this.baseScheme = this.generateBaseScheme();
|
|
737
|
+
this.complementaryScheme = this.generateComplementaryScheme();
|
|
738
|
+
this.metallic = this.generateMetallicColors();
|
|
739
|
+
}
|
|
740
|
+
gitHashToSeed(hash) {
|
|
741
|
+
return parseInt(hash.slice(0, 8), 16);
|
|
742
|
+
}
|
|
743
|
+
generateBaseScheme() {
|
|
744
|
+
const scheme = new (0, $5OpyM$colorscheme)();
|
|
745
|
+
return scheme.from_hue(this.seed % 360).scheme("analogic").variation("soft").colors().map((hex)=>`#${hex}`);
|
|
746
|
+
}
|
|
747
|
+
generateComplementaryScheme() {
|
|
748
|
+
const complementaryHue = (this.seed + 180) % 360;
|
|
749
|
+
const scheme = new (0, $5OpyM$colorscheme)();
|
|
750
|
+
return scheme.from_hue(complementaryHue).scheme("mono").variation("soft").colors().map((hex)=>`#${hex}`);
|
|
751
|
+
}
|
|
752
|
+
generateMetallicColors() {
|
|
753
|
+
return {
|
|
754
|
+
gold: "#FFD700",
|
|
755
|
+
silver: "#C0C0C0",
|
|
756
|
+
copper: "#B87333",
|
|
757
|
+
bronze: "#CD7F32"
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
getColorPalette(type = "sacred") {
|
|
761
|
+
switch(type){
|
|
762
|
+
case "sacred":
|
|
763
|
+
return {
|
|
764
|
+
primary: this.baseScheme[0],
|
|
765
|
+
secondary: this.baseScheme[1],
|
|
766
|
+
accent: this.complementaryScheme[0],
|
|
767
|
+
metallic: this.metallic.gold
|
|
768
|
+
};
|
|
769
|
+
case "elemental":
|
|
770
|
+
return {
|
|
771
|
+
earth: this.baseScheme[0],
|
|
772
|
+
water: this.baseScheme[1],
|
|
773
|
+
air: this.baseScheme[2],
|
|
774
|
+
fire: this.complementaryScheme[0]
|
|
775
|
+
};
|
|
776
|
+
case "chakra":
|
|
777
|
+
return {
|
|
778
|
+
root: "#FF0000",
|
|
779
|
+
sacral: "#FF7F00",
|
|
780
|
+
solar: "#FFFF00",
|
|
781
|
+
heart: "#00FF00",
|
|
782
|
+
throat: "#0000FF",
|
|
783
|
+
third_eye: "#4B0082",
|
|
784
|
+
crown: "#8F00FF"
|
|
785
|
+
};
|
|
786
|
+
default:
|
|
787
|
+
return this.baseScheme;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
function $367ed528f09d76bf$export$71b514a25c47df50(ctx, shape, x, y, fillColor, strokeColor, strokeWidth, size, rotation) {
|
|
796
|
+
ctx.save();
|
|
797
|
+
ctx.translate(x, y);
|
|
798
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
799
|
+
ctx.fillStyle = fillColor;
|
|
800
|
+
ctx.strokeStyle = strokeColor;
|
|
801
|
+
ctx.lineWidth = strokeWidth;
|
|
802
|
+
const drawFunction = (0, $0ced3eed8c5c8e0b$export$4ff7fc6f1af248b5)[shape];
|
|
803
|
+
if (drawFunction) drawFunction(ctx, size);
|
|
804
|
+
ctx.fill();
|
|
805
|
+
ctx.stroke();
|
|
806
|
+
ctx.restore();
|
|
807
|
+
}
|
|
808
|
+
function $367ed528f09d76bf$export$bb35a6995ddbf32d(ctx, shape, x, y, config) {
|
|
809
|
+
const { fillColor: fillColor, strokeColor: strokeColor, strokeWidth: strokeWidth, size: size, rotation: rotation, patterns: patterns = [], proportionType: proportionType = "GOLDEN_RATIO", baseOpacity: baseOpacity = 0.6, opacityReduction: opacityReduction = 0.1 } = config;
|
|
810
|
+
ctx.save();
|
|
811
|
+
ctx.translate(x, y);
|
|
812
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
813
|
+
// Draw base shape
|
|
814
|
+
ctx.fillStyle = fillColor;
|
|
815
|
+
ctx.strokeStyle = strokeColor;
|
|
816
|
+
ctx.lineWidth = strokeWidth;
|
|
817
|
+
const drawFunction = (0, $0ced3eed8c5c8e0b$export$4ff7fc6f1af248b5)[shape];
|
|
818
|
+
if (drawFunction) drawFunction(ctx, size);
|
|
819
|
+
// Layer additional patterns if specified
|
|
820
|
+
if (patterns.length > 0) (0, $7f8638f37c57b389$export$da2372f11bc66b3f).layerPatterns(ctx, patterns, {
|
|
821
|
+
baseSize: size,
|
|
822
|
+
baseOpacity: baseOpacity,
|
|
823
|
+
opacityReduction: opacityReduction,
|
|
824
|
+
proportionType: proportionType
|
|
825
|
+
});
|
|
826
|
+
ctx.fill();
|
|
827
|
+
ctx.stroke();
|
|
828
|
+
ctx.restore();
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* @typedef {Object} ArtConfig
|
|
836
|
+
* @property {number} width - Canvas width in pixels
|
|
837
|
+
* @property {number} height - Canvas height in pixels
|
|
838
|
+
* @property {number} [gridSize=4] - Number of grid cells (gridSize x gridSize)
|
|
839
|
+
* @property {number} [layers=5] - Number of layers to generate
|
|
840
|
+
* @property {number} [shapesPerLayer] - Base number of shapes per layer (defaults to grid cells * 1.5)
|
|
841
|
+
* @property {number} [minShapeSize=20] - Minimum shape size
|
|
842
|
+
* @property {number} [maxShapeSize=180] - Maximum shape size
|
|
843
|
+
* @property {number} [baseOpacity=0.6] - Starting opacity for first layer
|
|
844
|
+
* @property {number} [opacityReduction=0.1] - How much to reduce opacity per layer
|
|
845
|
+
*/ /**
|
|
846
|
+
* Generate an abstract art image from a git hash with custom configuration
|
|
847
|
+
* @param {string} gitHash - The git hash to use as a seed
|
|
848
|
+
* @param {ArtConfig} [config={}] - Configuration options
|
|
849
|
+
* @returns {Buffer} PNG buffer of the generated image
|
|
850
|
+
*/ function $cf838c15c8b009ba$export$491525bf12232411(gitHash, config = {}) {
|
|
851
|
+
// Default configuration
|
|
852
|
+
const defaultConfig = {
|
|
853
|
+
width: 2048,
|
|
854
|
+
height: 2048,
|
|
855
|
+
gridSize: 12,
|
|
856
|
+
layers: 2,
|
|
857
|
+
minShapeSize: 20,
|
|
858
|
+
maxShapeSize: 600,
|
|
859
|
+
baseOpacity: 0.8,
|
|
860
|
+
opacityReduction: 0.4
|
|
861
|
+
};
|
|
862
|
+
// Merge provided config with defaults
|
|
863
|
+
const finalConfig = {
|
|
864
|
+
...defaultConfig,
|
|
865
|
+
...config
|
|
866
|
+
};
|
|
867
|
+
const { width: width, height: height, gridSize: gridSize, layers: layers, minShapeSize: minShapeSize, maxShapeSize: maxShapeSize, baseOpacity: baseOpacity, opacityReduction: opacityReduction } = finalConfig;
|
|
868
|
+
// Calculate shapes per layer based on grid size if not provided
|
|
869
|
+
finalConfig.shapesPerLayer = finalConfig.shapesPerLayer || Math.floor(gridSize * gridSize * 1.5);
|
|
870
|
+
const canvas = (0, $5OpyM$createCanvas)(width, height);
|
|
871
|
+
const ctx = canvas.getContext("2d");
|
|
872
|
+
const colorScheme = new (0, $8f4da37788745c0d$export$ab958c550f521376)(gitHash);
|
|
873
|
+
const colors = colorScheme.getColorPalette("chakra");
|
|
874
|
+
// Create a gradient background
|
|
875
|
+
const gradient = ctx.createLinearGradient(0, 0, width, height);
|
|
876
|
+
gradient.addColorStop(0, colorScheme.baseScheme[0]);
|
|
877
|
+
gradient.addColorStop(1, colorScheme.baseScheme[1]);
|
|
878
|
+
ctx.fillStyle = gradient;
|
|
879
|
+
ctx.fillRect(0, 0, width, height);
|
|
880
|
+
const shapeNames = Object.keys((0, $0ced3eed8c5c8e0b$export$4ff7fc6f1af248b5));
|
|
881
|
+
const cellWidth = width / gridSize;
|
|
882
|
+
const cellHeight = height / gridSize;
|
|
883
|
+
// Scale shape sizes based on canvas dimensions
|
|
884
|
+
const scaleFactor = Math.min(width, height) / 1024;
|
|
885
|
+
const adjustedMinSize = minShapeSize * scaleFactor;
|
|
886
|
+
const adjustedMaxSize = maxShapeSize * scaleFactor;
|
|
887
|
+
for(let layer = 0; layer < layers; layer++){
|
|
888
|
+
const numShapes = finalConfig.shapesPerLayer + Math.floor((0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, layer, 0, finalConfig.shapesPerLayer / 2));
|
|
889
|
+
const layerOpacity = baseOpacity - layer * opacityReduction;
|
|
890
|
+
for(let i = 0; i < numShapes; i++){
|
|
891
|
+
const gridX = Math.floor(i / gridSize);
|
|
892
|
+
const gridY = i % gridSize;
|
|
893
|
+
const cellOffsetX = (0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, layer * numShapes + i * 2, 0, cellWidth);
|
|
894
|
+
const cellOffsetY = (0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, layer * numShapes + i * 2 + 1, 0, cellHeight);
|
|
895
|
+
const x = gridX * cellWidth + cellOffsetX;
|
|
896
|
+
const y = gridY * cellHeight + cellOffsetY;
|
|
897
|
+
const shape = shapeNames[Math.floor((0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, layer * numShapes + i * 3, 0, shapeNames.length))];
|
|
898
|
+
const size = adjustedMinSize + (0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, layer * numShapes + i * 4, 0, adjustedMaxSize - adjustedMinSize);
|
|
899
|
+
const rotation = (0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, layer * numShapes + i * 5, 0, 360);
|
|
900
|
+
const fillColorIndex = Math.floor((0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, layer * numShapes + i * 6, 0, colors.length));
|
|
901
|
+
const strokeColorIndex = Math.floor((0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, layer * numShapes + i * 7, 0, colors.length));
|
|
902
|
+
ctx.globalAlpha = layerOpacity;
|
|
903
|
+
// drawShape(
|
|
904
|
+
// ctx,
|
|
905
|
+
// shape,
|
|
906
|
+
// x,
|
|
907
|
+
// y,
|
|
908
|
+
// colors[fillColorIndex],
|
|
909
|
+
// colors[strokeColorIndex],
|
|
910
|
+
// 2 * scaleFactor,
|
|
911
|
+
// size,
|
|
912
|
+
// rotation
|
|
913
|
+
// );
|
|
914
|
+
(0, $367ed528f09d76bf$export$bb35a6995ddbf32d)(ctx, shape, x, y, {
|
|
915
|
+
fillColor: colors[fillColorIndex],
|
|
916
|
+
strokeColor: colors[strokeColorIndex],
|
|
917
|
+
strokeWidth: 1.5 * scaleFactor,
|
|
918
|
+
size: size,
|
|
919
|
+
rotation: rotation,
|
|
920
|
+
// Optionally add pattern combinations
|
|
921
|
+
// patterns:
|
|
922
|
+
// Math.random() > 0.7 ? PatternPresets.cosmicTree(size) : [],
|
|
923
|
+
proportionType: "GOLDEN_RATIO"
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
// Add connecting lines scaled to canvas size
|
|
927
|
+
ctx.globalAlpha = 0.2;
|
|
928
|
+
ctx.strokeStyle = colors[colors.length - 1];
|
|
929
|
+
ctx.lineWidth = 1 * scaleFactor;
|
|
930
|
+
const numLines = Math.floor(15 * (width * height) / 1048576);
|
|
931
|
+
for(let i = 0; i < numLines; i++){
|
|
932
|
+
const x1 = (0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, i * 4, 0, width);
|
|
933
|
+
const y1 = (0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, i * 4 + 1, 0, height);
|
|
934
|
+
const x2 = (0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, i * 4 + 2, 0, width);
|
|
935
|
+
const y2 = (0, $7f8638f37c57b389$export$6b193cae730c547a)(gitHash, i * 4 + 3, 0, height);
|
|
936
|
+
ctx.beginPath();
|
|
937
|
+
ctx.moveTo(x1, y1);
|
|
938
|
+
ctx.lineTo(x2, y2);
|
|
939
|
+
ctx.stroke();
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
return canvas.toBuffer("image/png");
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Save the generated image to a file
|
|
946
|
+
* @param {Buffer} imageBuffer - The PNG buffer of the generated image
|
|
947
|
+
* @param {string} outputDir - The directory to save the image
|
|
948
|
+
* @param {string} gitHash - The git hash used to generate the image
|
|
949
|
+
* @param {string} [label=''] - Label for the output file
|
|
950
|
+
* @param {number} width - The width of the generated image
|
|
951
|
+
* @param {number} height - The height of the generated image
|
|
952
|
+
* @returns {string} Path to the saved image
|
|
953
|
+
*/ function $cf838c15c8b009ba$export$ea0bbc160a51089a(imageBuffer, outputDir, gitHash, label = "", width, height) {
|
|
954
|
+
if (!(0, $5OpyM$fs).existsSync(outputDir)) (0, $5OpyM$fs).mkdirSync(outputDir, {
|
|
955
|
+
recursive: true
|
|
956
|
+
});
|
|
957
|
+
const filename = label ? `${label}-${width}x${height}-${gitHash.slice(0, 8)}.png` : `${gitHash.slice(0, 8)}-${width}x${height}.png`;
|
|
958
|
+
const outputPath = (0, $5OpyM$path).join(outputDir, filename);
|
|
959
|
+
(0, $5OpyM$fs).writeFileSync(outputPath, imageBuffer);
|
|
960
|
+
console.log(`Generated: ${outputPath}`);
|
|
961
|
+
return outputPath;
|
|
962
|
+
}
|
|
963
|
+
// Usage example:
|
|
964
|
+
/*
|
|
965
|
+
import { generateImageFromHash, saveImageToFile } from 'git-hash-art';
|
|
966
|
+
|
|
967
|
+
const gitHash = '1234567890abcdef1234567890abcdef12345678';
|
|
968
|
+
const imageBuffer = generateImageFromHash(gitHash, { width: 1024, height: 1024 });
|
|
969
|
+
const savedImagePath = saveImageToFile(imageBuffer, './output', gitHash, 'example', 1024, 1024);
|
|
970
|
+
console.log(`Image saved to: ${savedImagePath}`);
|
|
971
|
+
*/
|
|
972
|
+
|
|
973
|
+
export {$cf838c15c8b009ba$export$491525bf12232411 as generateImageFromHash, $cf838c15c8b009ba$export$ea0bbc160a51089a as saveImageToFile};
|
|
974
|
+
//# sourceMappingURL=main.js.map
|