• Stars
    star
    1,360
  • Rank 34,554 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Create generative art by using the canvas api and node js, feel free to contribute to this repo with new ideas.

Welcome to HashLips πŸ‘„

Important: There is a new repo for this code. https://github.com/HashLips/hashlips_art_engine

All the code in these repos was created and explained by HashLips on the main YouTube channel.

To find out more please visit:

πŸ“Ί YouTube

πŸ‘„ Discord

πŸ’¬ Telegram

🐦 Twitter

ℹ️ Website

generative-art-opensource

Create generative art by using the canvas api and node js, feel free to contribute to this repo with new ideas.

Project Setup

  • install node.js on your local system (https://nodejs.org/en/)
  • clone the repository to your local system [email protected]:HashLips/generative-art-opensource.git
  • run yarn install to install dependencies

How to use

Run the code

  1. Run node index.js
  2. Open the ./output folder to find your generated images to use as NFTs, as well as the metadata to use for NFT marketplaces.

Adjust the provided configuration and resources

Configuration file

The file ./input/config.js contains the following properties that can be adjusted to your preference in order to change the behavior of the NFT generation procedure:

  • width: - of your image in pixels. Default: 1000px
  • height: - of your image in pixels. Default: 1000px
  • dir: - where image parts are stored. Default: ./input
  • description: - of your generated NFT. Default: This is an NFT made by the coolest generative code.
  • baseImageUri: - URL base to access your NFTs from. This will be used by platforms to find your image resource. This expects the image to be accessible by it's id like ${baseImageUri}/${id}.
  • startEditionFrom: - number (int) to start naming NFTs from. Default: 1
  • editionSize: - number (int) to end edition at. Default: 10
  • editionDnaPrefix: - value (number or string) that indicates which dna from an edition is used there. I.e. dna 0 from to independent batches in the same edition may differ, and can be differentiated using this. Default: 0
  • rarityWeights: - allows to provide rarity categories and how many of each type to include in an edition. Default: 1 super_rare, 4 rare, 5 original
  • layers: list of layers that should be used to render the image. See next section for detail.

Image layers

The image layers are different parts that make up a full image by overlaying on top of each other. E.g. in the example input content of this repository we start with the eyeball and layer features like the eye lids or iris on top to create the completed and unique eye, which we can then use as part of our NFT collection. To ensure uniqueness, we want to add various features and multiple options for each of them in order to allow enough permutations for the amount of unique images we require.

To start, copy the layers/features and their images in a flat hierarchy at a directory of your choice (by default we expect them in ./input/). The features should contain options for each rarity that is provided via the config file.

After adding the layers, adjust them accordingly in the config.js by providing the directory path, positioning and sizes. Use the existing addLayers calls as guidance for how to add layers. This can either only use the name of the layer and will use default positioning (x=0, y=0) and sizes (width=configured width, height=configure height), or positioning and sizes can be provided for more flexibility.

Allowing different rarities for certain rarity/layer combinations

It is possible to provide a percentage at which e.g. a rare item would contain a rare vs. common part in a given layer. This can be done via the addRarityPercentForLayer that can be found in the config.js as well. This allows for more fine grained control over how much randomness there should be during the generation process, and allows a combination of common and rare parts.

Development suggestions

  • Preferably use VSCode with the prettifier plugin for a consistent coding style (or equivalent js formatting rules)

More Repositories

1

hashlips_art_engine

HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.
JavaScript
7,158
star
2

generative-art-node

Create generative art by using the canvas api and node js
JavaScript
2,147
star
3

hashlips_nft_minting_dapp

HashLips minting dapp is a quick and easy way to connect your smart contract and start minting NFTs.
JavaScript
1,019
star
4

hashlips_nft_contract

A simple NFT smart contract that works with the rest of the HashLips ecosystem.
Solidity
833
star
5

solidity_smart_contracts

A list of smart contracts coded in solidity
Solidity
593
star
6

example_nft_minter

Use this repo to see how to create a Dapp that can mint NFTs.
Solidity
253
star
7

nft_game

Learn how to create a NFT game and connect to a smart contract.
JavaScript
241
star
8

frontend_base_dapp

Base project for a dapp
JavaScript
173
star
9

hashlips_art_engine_app

HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.
JavaScript
138
star
10

nft_ipfs_minter

This repo is an example of how to mint an a nft with ipfs
JavaScript
134
star
11

solidity_basics

This repo forms part of the "Learn Solidity basics" tutorial on the HashLips youtube channel
Solidity
122
star
12

hashlips_art_pixelator

HashLips Art Pixelator is a tool used to convert multiple images to pixelated images.
JavaScript
109
star
13

hashlips_art_engine_ps_script

This script allows you to generate art works right from photoshop.
JavaScript
105
star
14

nerdy_coder_clones_tutorial

This repo forms part of the A-Z minting 1000 NFTs Dapp on polygon series.
Solidity
103
star
15

nft_collection_minter

Use this repo and explore ways to mint your NFT collections on the blockchain.
JavaScript
98
star
16

generative_names

Use this piece of code to generate random names.
JavaScript
86
star
17

hashlips_minting_card

This repo provides a nice and easy way for linking an existing NFT smart contract to this minting dapp.
JavaScript
86
star
18

thirdweb_minting_dapp

TypeScript
34
star
19

hashlips_dapp_setup

This repo is used in YouTube video tutorials
JavaScript
25
star
20

hashlips_react_three_fiber_starter

CSS
21
star
21

art-engine-template-with-plugins

TypeScript
6
star
22

random-activities-api

The API provides an endpoint to retrieve 20 random activities.
TypeScript
2
star
23

random-activities

The app showcases a list of 20 random activities for users to explore.
TypeScript
2
star