Discord
@hash/display-rgb-scale
Behavior
12
0
Public

Display RGB - Scaling

This behavior allows you to drive the "rgb" array of an agent from another property field on the agent. This is done by specifying the endpoints of two ranges: one for the "rgb" array, and one for the numeric values of the driving field. This behavio

This behavior allows you to drive the "rgb" array of an agent from another property field on the agent. This is done by specifying the endpoints of two ranges: one for the "rgb" array, and one for the numeric values of the driving field. This behavior automatically maps the value of the specified field to an "rgb" within the range. The scaling between the two can be specified as either linear or logarithmic.

Agent Properties

An agent with this behavior needs the following corresponding agent properties:

{
  ...
  "rgb_scaling": {
    "field": string, // the field whose values will drive the "rgb" values of the agent
    "field_bounds": [number], // the endpoints of the range of expected values of the field
    "bounds": [[number]], // the endpoints of the range for the "rgb" values
    "scale": string // the type of scaling - "linear" or "log"
  }
}

Since "rgb" values are an array, the endpoints will each be an array of 3 values as well.