Skip to main content

vJSONMapRange

Remaps every number in an array from its own smallest and largest value to a new range.

BeginnerMograph / JSONJSONArrayScriptVal
vJSONMapRange node

vJSONMapRange finds the smallest and the largest number in the whole input and maps that range linearly to New Min and New Max. The four Mode Select buttons are shortcuts for common new ranges.

Parameters​

ParameterTypeDefaultDescription
Mode SelectDropdown-1 - 1Buttons for -10 - 10, -1 - 1, 0 - 1 and 0 - 360. Pressing one sets New Min and New Max. The node does not read the selected button.
NewMinFloat-1Value that the smallest input number becomes. Allowed -50 to 50, default -1.
NewMaxFloat1Value that the largest input number becomes. Allowed -50 to 50, default 1.
InputDATATYPE—Primary point array input. Connect any upstream vArray generator or modifier here to apply range mapping to its values.
Read the full description

The node scans every number in the input, including numbers inside lists, and takes the smallest and largest one. Each number v then becomes NewMin + (v - min) * (NewMax - NewMin) / (max - min). The range is shared by all values and axes, so X, Y and Z are not remapped on their own. Text values that read as numbers are remapped too, and other values pass through.

Mode Select does not change the calculation. Its buttons -10 - 10, -1 - 1, 0 - 1 and 0 - 360 write those numbers into New Min and New Max when pressed. New Min and New Max accept -50 to 50 and default to -1 and 1, which is the default -1 - 1 button. If every number in the input is equal, all of them become New Min. The output is not clamped.

Example Connections​

vJSONPointsOnGrid.Output -> vJSONDisplaceValues.ArrayA
vJSONDisplaceValues.Output -> vJSONMapRange.ArrayA
vJSONMapRange.Output -> vJSONCameraProjection.ArrayA
vJSONCameraProjection.Output -> vJSONShapeRender.ArrayPoint
Background.Output -> vJSONShapeRender.Input