Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ability to specify an edition offset #1194

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,43 @@ const layerConfigurations = [
];
```

Update your `format` size, ie the outputted image size, and the `growEditionSizeTo` on each `layerConfigurations` object, which is the amount of variation outputted.
Update your `format` size, (i.e. 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 a custom edition offset for your layer configuration, you can specify an `editionOffset` in the _first_ `layerConfiguration` object.

_Example:_ You already generated collection of `120` NFTs and want to start generating more NFTs as a continuation of the collection.

```js
const layerConfigurations = [
{
editionOffset: 121, // start from 121
growEditionSizeTo: 100, // will generate 100 nfts named 121 - 220
layersOrder: [
{ name: "Head" },
{ name: "Mouth" },
{ name: "Eyes" },
{ name: "Eyeswear" },
{ name: "Headwear" },
],
},
{
// Creates an additional 100 artworks numbered 221 - 370
growEditionSizeTo: 150,
layersOrder: [
{ name: "Background" },
{ name: "Head" },
{ name: "Eyes" },
{ name: "Mouth" },
{ name: "Eyeswear" },
{ name: "Headwear" },
{ name: "AlienHeadwear" },
],
},
];
```

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.
Expand Down
3 changes: 2 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const solanaMetadata = {
// If you have selected Solana then the collection starts from 0 automatically
const layerConfigurations = [
{
growEditionSizeTo: 5,
//editionOffset: 11, // You can set this to start numbering from a custom offset other than the default which is 1
growEditionSizeTo: 15,
layersOrder: [
{ name: "Background" },
{ name: "Eyeball" },
Expand Down
24 changes: 19 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,19 @@ const startCreating = async () => {
let editionCount = 1;
let failedCount = 0;
let abstractedIndexes = [];
if (layerConfigurations.length === 0) {
throw new Error("No layer configurations found in config.js");
}
const editionOffset =
layerConfigurations[0].editionOffset &&
layerConfigurations[0].editionOffset >= 1
? layerConfigurations[0].editionOffset - 1
: 0;
const collectionSize =
layerConfigurations[layerConfigurations.length - 1].growEditionSizeTo;
for (
let i = network == NETWORK.sol ? 0 : 1;
i <= layerConfigurations[layerConfigurations.length - 1].growEditionSizeTo;
let i = editionOffset + (network == NETWORK.sol ? 0 : 1);
i <= editionOffset + collectionSize;
i++
) {
abstractedIndexes.push(i);
Expand Down Expand Up @@ -405,9 +415,13 @@ const startCreating = async () => {
addMetadata(newDna, abstractedIndexes[0]);
saveMetaDataSingleFile(abstractedIndexes[0]);
console.log(
`Created edition: ${abstractedIndexes[0]}, with DNA: ${sha1(
newDna
)}`
`${`${
editionOffset > 0
? abstractedIndexes[0] - editionOffset
: abstractedIndexes[0]
}`.padStart(Math.log(collectionSize), " ")} > Created edition: ${
abstractedIndexes[0]
}, with DNA: ${sha1(newDna)}`
);
});
dnaList.add(filterDNAOptions(newDna));
Expand Down