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

Generating glasses #1543

Open
wants to merge 6 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,6 @@ dist
# OSX

.DS_Store

/build
/layers
Binary file removed layers/Background/Black#1.png
Binary file not shown.
Binary file removed layers/Bottom lid/High#20.png
Binary file not shown.
Binary file removed layers/Bottom lid/Low#40.png
Binary file not shown.
Binary file removed layers/Bottom lid/Middle#40.png
Binary file not shown.
Binary file removed layers/Eye color/Cyan#1.png
Binary file not shown.
Binary file removed layers/Eye color/Green#1.png
Binary file not shown.
Binary file removed layers/Eye color/Pink#1.png
Binary file not shown.
Binary file removed layers/Eye color/Purple#1.png
Binary file not shown.
Binary file removed layers/Eye color/Red#1.png
Binary file not shown.
Binary file removed layers/Eye color/Yellow#10.png
Binary file not shown.
Binary file removed layers/Eyeball/Red#50.png
Binary file not shown.
Binary file removed layers/Eyeball/White#50.png
Binary file not shown.
Binary file removed layers/Goo/Green#1.png
Binary file not shown.
Binary file removed layers/Iris/Large#20.png
Binary file not shown.
Binary file removed layers/Iris/Medium#20.png
Binary file not shown.
Binary file removed layers/Iris/Small#60.png
Binary file not shown.
Binary file removed layers/Shine/Shapes#100.png
Binary file not shown.
Binary file removed layers/Top lid/High#30.png
Binary file not shown.
Binary file removed layers/Top lid/Low#20.png
Binary file not shown.
Binary file removed layers/Top lid/Middle#50.png
Binary file not shown.
14 changes: 14 additions & 0 deletions rename.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os

# specify the directory containing the files
directory = "./layers/"

# loop through all the files and subdirectories in the directory
for root, dirs, files in os.walk(directory):
for filename in files:
# create the new filename by replacing "-" with " "
new_filename = filename.replace("-", " ")
print(filename)

# rename the file with the new filename
os.rename(os.path.join(root, filename), os.path.join(root, new_filename))
57 changes: 42 additions & 15 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const { NETWORK } = require(`${basePath}/constants/network.js`);
const network = NETWORK.eth;

// General metadata for Ethereum
const namePrefix = "Your Collection";
const description = "Remember to replace this description";
const namePrefix = "Sunglasses ";
const description = "Description of the collection";
const baseUri = "ipfs://NewUriToReplace";

const solanaMetadata = {
Expand All @@ -24,26 +24,53 @@ const solanaMetadata = {
// If you have selected Solana then the collection starts from 0 automatically
const layerConfigurations = [
{
growEditionSizeTo: 5,
growEditionSizeTo: 40,
layersOrder: [{ name: "LensAviator" }, { name: "FrameAviator" }],
},
{
growEditionSizeTo: 80,
layersOrder: [
{ name: "Background" },
{ name: "Eyeball" },
{ name: "Eye color" },
{ name: "Iris" },
{ name: "Shine" },
{ name: "Bottom lid" },
{ name: "Top lid" },
{ name: "LensAviatorFlatTop" },
{ name: "FrameAviatorFlatTop" },
],
},
{
growEditionSizeTo: 120,
layersOrder: [{ name: "LensBox" }, { name: "FrameBox" }],
},
{
growEditionSizeTo: 160,
layersOrder: [{ name: "LensCatsEye" }, { name: "FrameCatsEye" }],
},
{
growEditionSizeTo: 200,
layersOrder: [{ name: "LensOvel" }, { name: "FrameOvel" }],
},
{
growEditionSizeTo: 240,
layersOrder: [{ name: "LensOversized" }, { name: "FrameOversized" }],
},
{
growEditionSizeTo: 280,
layersOrder: [{ name: "LensRetro" }, { name: "FrameRetro" }],
},
{
growEditionSizeTo: 320,
layersOrder: [{ name: "LensSquare" }, { name: "FrameSquare" }],
},
{
growEditionSizeTo: 360,
layersOrder: [{ name: "LensWayfarer" }, { name: "FrameWayfarer" }],
},
];

const shuffleLayerConfigurations = false;
const shuffleLayerConfigurations = true;

const debugLogs = false;

const format = {
width: 512,
height: 512,
width: 2160,
height: 2160,
smoothing: false,
};

Expand Down Expand Up @@ -72,7 +99,7 @@ const pixelFormat = {
};

const background = {
generate: true,
generate: false,
brightness: "80%",
static: false,
default: "#000000",
Expand All @@ -92,7 +119,7 @@ const preview = {
};

const preview_gif = {
numberOfImages: 5,
numberOfImages: 10,
order: "ASC", // ASC, DESC, MIXED
repeat: 0,
quality: 100,
Expand Down
4 changes: 3 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ const layersSetup = (layersOrder) => {
};

const saveImage = (_editionCount) => {
var frame = attributesList[0].value;
var lens = attributesList[1].value;
fs.writeFileSync(
`${buildDir}/images/${_editionCount}.png`,
`${buildDir}/images/${frame} ${lens}#1.png`,
canvas.toBuffer("image/png")
);
};
Expand Down