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

how to edit addRarityPercentForLayer to create images without a certain layer #36

Closed Y-Ali closed 3 years ago

Y-Ali commented 3 years ago

I'm trying to find a way to edit this part of the code to allow some images to be created that do not include any layers from my 'accessory' folder:

addRarityPercentForLayer('original', 'accessory', { 'super_rare': 10, 'rare': 30, 'original': 70 });
addRarityPercentForLayer('rare', 'accessory', { 'super_rare': 0, 'rare': 100, 'original': 0 });
addRarityPercentForLayer('super rare', 'accessory', { 'super_rare': 60, 'rare': 40, 'original': 0 });

Currently, if I run the code with the above; every single image that is created seems to have the accessory layer but I would want some images not to have this layer - any suggestions?

Thanks!

EvilShaggz commented 3 years ago

I just put a transparent image with none in that folder to fix it for me

pehcastro commented 3 years ago

I just put a transparent image with none in that folder to fix it for me

I do this too, you can use the image as "no accessory.png" for metadata output, works fine.

Y-Ali commented 3 years ago

Thank you for this suggestion @EvilShaggz @pehcastro !