Degenerates are lazy and stubborn creatures of low intellect that lurk on the hidden part of your computer feeding on personal data. They often reveal themselves in search of data when none is around.
This is an Illustrator script that generates 31 by 31 pixels images with a dinosaur in the shape of the character from the built-in Dinosaur Game on the Chrome web browser. The script is based on JS's older ES3 standards so a lot of things are somewhat outdated or redundant at times.
The goal of this project was to challenge myself in creating some sort of script that generates NFTs which seems to be very popular nowadays. This is my first project using javascript and first formal programming project.
Below are the steps that need to be taken to try the script for yourself along with basic explanations for the different components of the script.
The project is structured in a way that is reproducable by others. You will need to have Adobe Illustrator installed (preferably version 2020 or up).
Place the index_alias.js
within the dedicated script folder of Illustrator and edit the first line to add the filepath to the NFT script folder.
The script directory can be accessed thru /Adobe Illustrator CC/Presets/en_GB/Scripts
in the Applications
folder on Mac OS or in Program Files
on Windows.
You will need to restart Illustrator after making the changes.
Running the script outside of Illustrator via index_alias.js
will avoid its potential deletion when updating Illustrator.
Once done, open template.ai
and run the 'index_alias' under File > Scripts and Voilà! (currently not available due to copy rights)
First, a character silhouette is generated based on a set of traits including pose, walking state, and mouth state:
Some traits are rarer than others. For exemple roaring has only a 7.5% of occuring while a running character has 50%...
Some traits have a greater impact on rarity than others too.
For exemple, the pattern of the character has 4 times greater impact than the expression of the character.
To simplify things, traits are categorized as either weak, moderate, or strong.
The probabilities and impact factors can be altered in params.js
.
I base color is added to the character along side shades to add more depth:
Textured are generated and clipped to the character. Textures vary from simple spots to horizontal and vertical stripes to even sin wave pattern:
Depending on the pattern, there is a small chance of repeating itself, returning more than color.
The pattern porbabilities can also be changed in the params.js
.
1 of the 38 available eyes is selected at random and copied ontop of the character.
Also, to make things a little more intersting, there is a 5% chance that the dinosaur is tammed. When tammed, the dinosaur will wear either a scraf or a ribbon.
For both eyes and scarfs, any number can be added or modified within the eyes
and scarf
layers respectively.
The name of each Degenerates is contructed of an adjective or verb followed by a color name. The adjective or verb depends on the combination of traits.
While the final image is of high enough quality, it's not pixel perfect due to the required anti-aliasing applied on the export. To remedy this, an aditional script needs to be created in order to convert the output png into a 31 by 31 pixel mozaic object and exported once more.
Also, this script uses Chirag Mehta's name-that-color library to generate names: http://chir.ag/projects/ntc.