CustomLinear

Source: Gradient.ts

Custom linear gradient with colors evenly spaced from min to max.
Equal min and max values use the midpoint of the color ramp.
An empty palette uses black; a one-color palette is constant.
Reverse gradients are supported when min>max so that the colors are displayed in reverse order.
A custom numeric midpoint is not supported; specify colors to choose the middle color.

Example

CODE
$3Dmol.get('../test_structs/af.pdb', function(data){
              viewer.addModel(data);
              viewer.setStyle({cartoon:{colorscheme:{prop: 'b', gradient:'linear', min: 70, max: 100, colors: ["blue","yellow","green"]}}});
              viewer.zoomTo();
              viewer.render();
            });

Constructor

new CustomLinear( min: number, max: number, colors: Array, ): CustomLinear

Parameters

  • min (number)
  • max (number)
  • colors (Array) — Array of colors that will be linearly interpolated between from min to max values.