HashLips / generative-art-opensource

Create generative art by using the canvas api and node js, feel free to contribute to this repo with new ideas.
MIT License
1.36k stars 690 forks source link

Can't generate more than 11 images #196

Open jiim123 opened 2 years ago

jiim123 commented 2 years ago

Hi, I found this issue but that didn't help me. I guess it has been updated since then, but anyway, I'm trying to generate more than 11 images, beneath 11 is fine, but when I go above I get the following:

Quick note: I have edited the name of each image so it ends with #1 #2 #3 etc. (i.e Rare Orange Eyes #1.png) - do I have to do anything else, in the code for example?

start creating NFTs.
-----------------
creating NFT 1 of 50
- rarity: undefined
D:\NFT\Generative OpenSource\generative-art-opensource-main\index.js:133
    let num = Math.floor(Math.random() * layer.elementIdsForRarity[_rarity].length);
                                                                            ^

TypeError: Cannot read properties of undefined (reading 'length')
    at D:\NFT\Generative OpenSource\generative-art-opensource-main\index.js:133:77
    at Array.forEach (<anonymous>)
    at createDna (D:\NFT\Generative OpenSource\generative-art-opensource-main\index.js:132:11)
    at startCreating (D:\NFT\Generative OpenSource\generative-art-opensource-main\index.js:200:18)      
    at Object.<anonymous> (D:\NFT\Generative OpenSource\generative-art-opensource-main\index.js:249:1)  
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

Thanks!

Moufledalf commented 2 years ago

Same problems here , any solution ?

houssaineamzil commented 2 years ago

make sure to change the original number to match the editionSize num

const editionSize = 100
// ...
let rarityWeights = [
  addRarity('super_rare', 1, 1),
  addRarity('rare', 2, 5),
  addRarity('original', 5, 100)
];