MCPcopy Create free account
hub / github.com/HashLips/hashlips_art_engine / startCreating

Function startCreating

src/main.js:337–430  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

335}
336
337const startCreating = async () => {
338 let layerConfigIndex = 0;
339 let editionCount = 1;
340 let failedCount = 0;
341 let abstractedIndexes = [];
342 for (
343 let i = network == NETWORK.sol ? 0 : 1;
344 i <= layerConfigurations[layerConfigurations.length - 1].growEditionSizeTo;
345 i++
346 ) {
347 abstractedIndexes.push(i);
348 }
349 if (shuffleLayerConfigurations) {
350 abstractedIndexes = shuffle(abstractedIndexes);
351 }
352 debugLogs
353 ? console.log("Editions left to create: ", abstractedIndexes)
354 : null;
355 while (layerConfigIndex < layerConfigurations.length) {
356 const layers = layersSetup(
357 layerConfigurations[layerConfigIndex].layersOrder
358 );
359 while (
360 editionCount <= layerConfigurations[layerConfigIndex].growEditionSizeTo
361 ) {
362 let newDna = createDna(layers);
363 if (isDnaUnique(dnaList, newDna)) {
364 let results = constructLayerToDna(newDna, layers);
365 let loadedElements = [];
366
367 results.forEach((layer) => {
368 loadedElements.push(loadLayerImg(layer));
369 });
370
371 await Promise.all(loadedElements).then((renderObjectArray) => {
372 debugLogs ? console.log("Clearing canvas") : null;
373 ctx.clearRect(0, 0, format.width, format.height);
374 if (gif.export) {
375 hashlipsGiffer = new HashlipsGiffer(
376 canvas,
377 ctx,
378 `${buildDir}/gifs/${abstractedIndexes[0]}.gif`,
379 gif.repeat,
380 gif.quality,
381 gif.delay
382 );
383 hashlipsGiffer.start();
384 }
385 if (background.generate) {
386 drawBackground();
387 }
388 renderObjectArray.forEach((renderObject, index) => {
389 drawElement(
390 renderObject,
391 index,
392 layerConfigurations[layerConfigIndex].layersOrder.length
393 );
394 if (gif.export) {

Callers 1

index.jsFile · 0.50

Calls 13

shuffleFunction · 0.85
layersSetupFunction · 0.85
createDnaFunction · 0.85
isDnaUniqueFunction · 0.85
constructLayerToDnaFunction · 0.85
loadLayerImgFunction · 0.85
drawBackgroundFunction · 0.85
drawElementFunction · 0.85
addMetadataFunction · 0.85
saveMetaDataSingleFileFunction · 0.85
filterDNAOptionsFunction · 0.85
saveImageFunction · 0.70

Tested by

no test coverage detected