Generate your collection
Create generative NFTs collection
First of all download the generator below:
Create generative nft by using the canvas api and node js. Before you use the generation engine, make sure you have node.js(v14.0.0) installed. NodeJS : https://nodejs.org/
Installation đ ī¸
Go to the root of your folder and run this command if you have yarn installed.
Alternatively you can run this command if you have node installed.
Usage
Create your different layers as folders in the layers
directory, and add all the layer assets in these directories. You can name the assets anything as long as it has a rarity weight attached in the file name like so: example element#70.png
. You can optionally change the delimiter #
to anything you would like to use in the variable rarityDelimiter
in the src/config.js
file.
Once you have all your layers, go into src/config.js
and update the layerConfigurations
objects layersOrder
array to be your layer folders name in order of the back layer to the front layer.
Example: If you were creating a portrait design, you might have a background, then a head, a mouth, eyes, eyewear, and then headwear, so your layersOrder
would look something like this:
The name
of each layer object represents the name of the folder (in /layers/
) that the images reside in.
Optionally you can now add multiple different layerConfigurations
to your collection. Each configuration can be unique and have different layer orders, use the same layers or introduce new ones. This gives the artist flexibility when it comes to fine tuning their collections to their needs.
Example: If you were creating a portrait design, you might have a background, then a head, a mouth, eyes, eyewear, and then headwear and you want to create a new race or just simple re-order the layers or even introduce new layers, then you're layerConfigurations
and layersOrder
would look something like this:
Update your format
size, ie the outputted image size, and the growEditionSizeTo
on each layerConfigurations
object, which is the amount of variation outputted.
You can mix up the layerConfigurations
order on how the images are saved by setting the variable shuffleLayerConfigurations
in the config.js
file to true. It is false by default and will save all images in numerical order.
If you want to have logs to debug and see what is happening when you generate images you can set the variable debugLogs
in the config.js
file to true. It is false by default, so you will only see general logs.
If you want to play around with different blending modes, you can add a blend: MODE.colorBurn
field to the layersOrder options
object.
If you need a layers to have a different opacity then you can add the opacity: 0.7
field to the layersOrder options
object as well.
If you want to have a layer ignored in the DNA uniqueness check, you can set bypassDNA: true
in the options
object. This has the effect of making sure the rest of the traits are unique while not considering the Background
Layers as traits, for example. The layers are included in the final image.
To use a different metadata attribute name you can add the displayName: "Awesome Eye Color"
to the options
object. All options are optional and can be addes on the same layer if you want to.
Here is an example on how you can play around with both filter fields:
Here is a list of the different blending modes that you can optionally use.
When you are ready, run the following command and your outputted art will be in the build/images
directory and the json in the build/json
directory:
or
The program will output all the images in the build/images
directory along with the metadata files in the build/json
directory. Each collection will have a _metadata.json
file that consists of all the metadata in the collection inside the build/json
directory. The build/json
folder also will contain all the single json files that represent each image file. The single json file of a image will look something like this:
You can also add extra metadata to each metadata file by adding your extra items, (key: value) pairs to the extraMetadata
object variable in the config.js
file.
If you don't need extra metadata, simply leave the object empty. It is empty by default.
That's it, you're done.
Utils
Updating baseUri for IPFS and description
You might possibly want to update the baseUri and description after you have ran your collection. To update the baseUri and description simply run:
Generate a preview image
Create a preview image collage of your collection, run:
Generate GIF images from collection
In order to export gifs based on the layers created, you just need to set the export on the gif
object in the src/config.js
file to true
. You can also play around with the repeat
, quality
and the delay
of the exported gif.
Setting the repeat: -1
will produce a one time render and repeat: 0
will loop forever.
Printing rarity data (Experimental feature)
To see the percentages of each attribute across your collection, run:
The output will look something like this:
Hope you create some awesome NFTs Collections with this
Last updated