



Description
This component allows for the parametric definition and evaluation of a color gradient. Using a list of colors as an input a gradient will be created from the sequential pattern. Optional corresponding percent values can be used to specify the unitized location of each color along the gradient sequence. A unitized value can then be sampled from the gradient returning the color at the specified location. Additionally, the gradient can be toggled between a linear or a smoothed (cosine based) gradation between provided colors.
Components

Parametric Gradient
V | In | Double | Item | The unitized (0-1) percent value from which the gradient will be sampled |
C | In | Color | List | A sequential list of colors defining the gradient pattern |
T | In | Double | List | An optional list of unitized percent values which represent the placement on the gradient of each matching color. The number of values must match the number of colors, else the colors will be evenly distributed |
L | In | Boolean | Item | If true the gradient will be interpolated using a linear gradation, else colors will be interpolated using a cosine equation |
A | Out | Color | Item | The color at the given sample value |
Downloads
Minimum Requirements
Platform | Rhino 5, Grasshopper |
Version | Grasshopper 0.9.0075 |
Type | C# Component |
As written this only interpolates RGB. I wanted it to do alpha as well so I edited the source like this:
If L Then
A = color.FromArgb(ReMapClr(fClr.A, cClr.A, j), ReMapClr(fClr.R, cClr.R, j), ReMapClr(fClr.G, cClr.G, j), ReMapClr(fClr.B, cClr.B, j))
Else
A = color.FromArgb(ReMapClrA(fClr.A, cClr.A, j), ReMapClrA(fClr.R, cClr.R, j), ReMapClrA(fClr.G, cClr.G, j), ReMapClrA(fClr.B, cClr.B, j))
End If
If you too wish alpha interpolation, go forth and do likewise.
-B