Essentials
Getting Started
Artist Guides
Project Setup and Artist Tools
The fx(hash) API
Generative Art with fx(params)
Browser Based Generative Art
Releasing your Project
An quick overview of the functions that the fx(hash) API provides.
Function | Function Signature | Purpose / Effect |
---|---|---|
hash |
string | The hash string provided (or injected into) for each iteration. |
rand() |
() => number | Generates a pseudo-random number using the hash as the seed, ranging from 0 (inclusive) to just under 1 (exclusive). |
rand.reset() |
() => void | Reinitialises the $fx.rand() generator to its original state. |
minter |
string | The wallet address of the minter, provided (or injected into) for each iteration. |
randminter() |
() => number | Similar to rand() , but uses the minter's address as the seed, with the same output range. |
randminter.reset() |
() => void | Reinitialises the $fx.randminter() generator just like rand.reset() . |
context |
string | Indicates where the code is running: standalone, during capture, or while minting. |
iteration |
number | The iteration number of the collected GENTK. |
preview() |
() => void | Triggers the image capture module at mint time to create the image preview for the collected iteration. |
isPreview |
boolean | Set to true when the code runs in the fxhash capture module. Useful for defining capture-specific properties. |
features() |
(object) => void | Function that specifies the features of the collected iteration. |
getFeature() |
(string) => any | Retrieves the value of a named feature as set by the features() function. |
getFeatures() |
() => object | Returns the entire features object as defined by features() . |
params() |
(array) => void | Define collector-modifiable parameters for your piece by calling this with an array. |
getParam() |
(string) => any | Returns the value of a param via its ID. |
getParams() |
() => object | Returns a dictionary of all parameter key-value pairs, as currently set. |
getRawParam() |
(string) => string | Provides the raw parameter data (as a bytes string) as it was passed to the iteration. |
on() |
(string, function, function) => function | Registers an event listener and returns a function to deregister it. |
emit() |
(string, any) => void | Sends an event to the parent context, useful for dynamic parameter updates from within the code. |
← Previous
Project SDK & API: Integration and Use
Next →