|
1 | | -# Welcome to HashLips |
| 1 | +# Welcome to HashLips 👄 |
| 2 | + |
| 3 | + |
2 | 4 |
|
3 | 5 | All the code in these repos was created and explained by HashLips on the main YouTube channel. |
4 | 6 |
|
5 | 7 | To find out more please visit: |
6 | 8 |
|
7 | | -[HashLips YouTube](https://www.youtube.com/channel/UC1LV4_VQGBJHTJjEWUmy8nA) |
| 9 | +[📺 YouTube](https://www.youtube.com/channel/UC1LV4_VQGBJHTJjEWUmy8nA) |
| 10 | + |
| 11 | +[💬 Telegram](https://t.me/hashlipsnft) |
8 | 12 |
|
9 | | -[HashLips Telegram](https://t.me/hashlipsnft) |
| 13 | +[🐦 Twitter](https://twitter.com/hashlipsnft) |
10 | 14 |
|
11 | | -[HashLips Twitter](https://twitter.com/hashlipsnft) |
| 15 | +[ℹ️ Website](https://hashlips.online/HashLips) |
12 | 16 |
|
13 | | -[HashLips Website](https://hashlips.online/HashLips) |
| 17 | +# HashLips Art Engine 🔥 |
14 | 18 |
|
15 | | -# HashLips Art Engine |
| 19 | + |
16 | 20 |
|
17 | 21 | Create generative art by using the canvas api and node js. Before you use the generation engine, make sure you have node.js and yarn installed. |
18 | 22 |
|
19 | | -## Installation |
| 23 | +## Installation 🛠️ |
| 24 | + |
| 25 | +If you are cloning the project then run this first, otherwise you can download the source code on the release page and skip this step. |
20 | 26 |
|
21 | 27 | ```sh |
22 | 28 | git clone https://github.com/HashLips/hashlips_art_engine.git |
| 29 | +``` |
| 30 | + |
| 31 | +Go to the root of your folder and run this command if you have yarn installed. |
23 | 32 |
|
| 33 | +```sh |
24 | 34 | yarn add all |
25 | 35 | ``` |
26 | 36 |
|
27 | | -## Usage |
| 37 | +Alternatively you can run this command if you have node installed. |
28 | 38 |
|
29 | | -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` |
| 39 | +```sh |
| 40 | +npm install |
| 41 | +``` |
| 42 | + |
| 43 | +## Usage ℹ️ |
30 | 44 |
|
31 | | -Once you have all your layers, go into `src/config.js` and update the `layersOrder` array to be your layer folders name in order of the back layer to the front layer. |
| 45 | +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. |
32 | 46 |
|
33 | | -*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: |
| 47 | +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. |
| 48 | + |
| 49 | +_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: |
34 | 50 |
|
35 | 51 | ```js |
36 | | -const layersOrder = [ |
37 | | - { name: 'Background'}, |
38 | | - { name: 'Ball'}, |
39 | | - { name: 'Eye color' }, |
40 | | - { name: 'Iris' }, |
41 | | - { name: 'Shine' }, |
42 | | - { name: 'Bottom lid' }, |
43 | | - { name: 'Top lid' }, |
| 52 | +const layerConfigurations = [ |
| 53 | + { |
| 54 | + growEditionSizeTo: 100, |
| 55 | + layersOrder: [ |
| 56 | + { name: "Head" }, |
| 57 | + { name: "Mouth" }, |
| 58 | + { name: "Eyes" }, |
| 59 | + { name: "Eyeswear" }, |
| 60 | + { name: "Headwear" }, |
| 61 | + ], |
| 62 | + }, |
44 | 63 | ]; |
45 | 64 | ``` |
46 | 65 |
|
47 | | -The `name` of each layer object represents the name of the folder (in `/layers/`) that the images reside in. |
| 66 | +The `name` of each layer object represents the name of the folder (in `/layers/`) that the images reside in. |
| 67 | + |
| 68 | +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. |
48 | 69 |
|
49 | | -Then optionally, update your `format` size, ie the outputted image size, and the `editionSize`, which is the amount of variation outputted. |
| 70 | +_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: |
| 71 | + |
| 72 | +```js |
| 73 | +const layerConfigurations = [ |
| 74 | + { |
| 75 | + // Creates up to 50 artworks |
| 76 | + growEditionSizeTo: 50, |
| 77 | + layersOrder: [ |
| 78 | + { name: "Background" }, |
| 79 | + { name: "Head" }, |
| 80 | + { name: "Mouth" }, |
| 81 | + { name: "Eyes" }, |
| 82 | + { name: "Eyeswear" }, |
| 83 | + { name: "Headwear" }, |
| 84 | + ], |
| 85 | + }, |
| 86 | + { |
| 87 | + // Creates an additional 100 artworks |
| 88 | + growEditionSizeTo: 150, |
| 89 | + layersOrder: [ |
| 90 | + { name: "Background" }, |
| 91 | + { name: "Head" }, |
| 92 | + { name: "Eyes" }, |
| 93 | + { name: "Mouth" }, |
| 94 | + { name: "Eyeswear" }, |
| 95 | + { name: "Headwear" }, |
| 96 | + { name: "AlienHeadwear" }, |
| 97 | + ], |
| 98 | + }, |
| 99 | +]; |
| 100 | +``` |
| 101 | + |
| 102 | +Then optionally, update your `format` size, ie the outputted image size, and the `growEditionSizeTo` on each `layerConfigurations` object, which is the amount of variation outputted. |
50 | 103 |
|
51 | 104 | When you are all ready, run the following command and your outputted art will be in the `build` directory: |
52 | 105 |
|
53 | 106 | ```sh |
54 | 107 | npm run build |
55 | 108 | ``` |
| 109 | + |
| 110 | +or |
| 111 | + |
| 112 | +```sh |
| 113 | +node index.js |
| 114 | +``` |
| 115 | + |
| 116 | +The program will output all the images in the `build` directory along with the metadata files. Each collection will have a `_metadata.json` file that consists of all the metadata in the collection inside the `build` folder. The `build` folder also will contain all the images as well as single json files that represent each image file. The single json file of a image will look something like this: |
| 117 | + |
| 118 | +```json |
| 119 | +{ |
| 120 | + "dna": "d956cdf4e460508b5ff90c21974124f68d6edc34", |
| 121 | + "name": "#1", |
| 122 | + "description": "This is the description of your NFT project", |
| 123 | + "image": "https://hashlips/nft/1.png", |
| 124 | + "edition": 1, |
| 125 | + "date": 1731990799975, |
| 126 | + "attributes": [ |
| 127 | + { "trait_type": "Background", "value": "Black" }, |
| 128 | + { "trait_type": "Eyeball", "value": "Red" }, |
| 129 | + { "trait_type": "Eye color", "value": "Yellow" }, |
| 130 | + { "trait_type": "Iris", "value": "Small" }, |
| 131 | + { "trait_type": "Shine", "value": "Shapes" }, |
| 132 | + { "trait_type": "Bottom lid", "value": "Low" }, |
| 133 | + { "trait_type": "Top lid", "value": "Middle" } |
| 134 | + ], |
| 135 | + "compiler": "HashLips Art Engine" |
| 136 | +} |
| 137 | +``` |
| 138 | + |
| 139 | +That's it, you're done. Hope you create some awesome artworks with this code 👄. |
0 commit comments