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 695 forks source link

How do I make it so that it randomizes the rarity for each layer? For example, one character could have a rare body with original hair and a super rare attribute instead of everything being the same rarity. #46

Open thecryptobirdie opened 2 years ago

Ponda1 commented 2 years ago

Which branch are you using? Because you can easily do that on the main branch by editing the RarityPercentForLayer values.

thecryptobirdie commented 2 years ago

Thanks for your response. What do you mean which branch?

thecryptobirdie commented 2 years ago

Im looking to totally randomize when each rarity shows up, so it doesnt group all the super rare attributes together or all the rare attributes together. It will be totally random so a png would have one layer thats super rare and another thats rare and another thats original

Ponda1 commented 2 years ago

On the github download page for the code there is a dropdown menu which tells you the branch. Its on the "main" branch at default so I assume thats the one youre using. If thats the case then you should be able to randomize each layer easily. I have already kind of explained how to do that in issue #33 which has been closed so you can go there and check it out. I hope this helped :)

thecryptobirdie commented 2 years ago

Just took a look at it. Could you walk me through word by word what everything here means? I wanted to have multiple variations and rarities for all the attributes. Would I need to make more lines of this?

addRarityPercentForLayer('super_rare', 'background', { 'super_rare': 20, 'rare': 30, 'original': 50 }); addRarityPercentForLayer('rare', 'background', { 'super_rare': 10, 'rare': 25, 'original': 65 }); addRarityPercentForLayer('original', 'accessories, { 'super_rare': 50, 'rare': 25, 'original': 25 });

Ponda1 commented 2 years ago

I hope my answer in #44 solved it for you

thecryptobirdie commented 2 years ago

Got it! All good now. Thank you so much!!!