This document will walk you through all the concepts you need to know to understand how to create a collection on Genify.
Knowledge requirements
When creating a generative art collection for Genify, you will need to master HTML techniques. When building a collection, you can use p5.js, three.js and other familiar front-end rendering technologies. The entry file for the collection is index.html.
At the same time, when your project is rendering, you need to ensure the same performance under the same genhash. You can use the incoming genhash to construct a deterministic random function. Don't worry if you're new to this technology. We have ready-to-use code snippets for you, just import them at the appropriate location in index.html.
Collection Document Requirements
Standard zip file only.
When compressing the zip file, directly select all files in the collection folder to compress, do not directly compress the workpiece folder.
Do not use external links to introduce third-party js/css and other resources in the code, you need to download the resources and put them in the project folder.
Display material for project tips
feature.png (4:3) , icon.png (1:1) , cover.png (1:1) files can be added directly to the collection folder.
If no display material is provided, the website will use the zero HASH as the parameter to generate the material after the collection is launched.
let zeroHash = '0x0000000000000000000000000000000000000000000000000000000000000000'
Deterministic random function
The random function used in the collection must be deterministic.
In each rendering, the genhash parameter is passed in to generate random numbers.
The specific usage is as follows: (The following code can be introduced in index.html)
After integrating the above code, you can use the Genify.random() function to get random numbers.
//get a random value
var value = Genify.random();
//also you can define a variable for this function for easy use
var genrand = Genify.random;
var value = genrand();
//in p5.js
let seed = ~~(Genify.random() * 123456789);
function setup() {
randomSeed(seed);
noiseSeed(seed);
}
Of course, you can also directly obtain the hash value by parsing the parameters in the URL, and then generate the random number through CRC32, so that the above code does not need to be introduced into the page.
It is not recommended to directly replace Math.random with Genify.random, the output result may be affected by some plug-ins installed in the user's browser.
Provide attributes to your artworks
The attribute is a Map, the key is the attribute name, and the value is the attribute value. The attribute value can be suggested to use string, number, or boolean value type.
You can set the properties of your work through Genify.setGenFeatures() every time you render, so that your work can have scarcity in Genify.
var features = {
"eyes": "blue",
"hair": "brown",
"skin": "white",
"clothes": "red",
"accessories": "none"
};
Genify.setGenFeatures(features);
You can also directly set the properties of your works through window.$genFeatures on the page, so that your works can have scarcity in Genify.
After a Token is minted, Genify Server generates a screenshot for each Token to be displayed on the website. The screenshot is created by capturing the browser's view of the token URL. To ensure your work is well-presented on the website, you should pay attention to its rendering performance in the browser, as well as rendering duration and viewport size. Consider the following recommendations:
Eliminate any gaps between the drawing area (e.g., canvas) and the body by setting padding and margin to 0.
Handle the OnSize event to ensure rendering isn't affected when the window size changes.
Use Chrome's developer tools to test appropriate viewport sizes.
If you know exactly when your work finishes rendering, call Genify.renderDone() to actively set the status upon completion.
Optimize image and resource loading: Use appropriate compression methods and formats to reduce loading time and bandwidth consumption. Consider using WebP or other modern image formats.