SetColorAndOpacity Method

The SetColorAndOpacity method is used to set the gradient fill to custom colors and opacities. Use the Name property to set the gradient to a predefined color gradient.

Syntax

object.SetColorAndOpacity(colorNodes, colors, opacityNodes, opacities)

 

Parameter Type Description
colorNodes Variant required, percent locations in the color gradient for each custom color
colors Variant required, Grapher color names or RGB color combination
opacityNodes Variant required, percent locations in the opacity gradient for each opacity
opacities Variant required, percent transparency for opacity nodes

 

Example

This example shows how to set the gradient to custom colors for a rectangle.

'Set up percent stops gradient

Dim Array1(6) As Double

Array1(0) = 0

Array1(1) = 0.10

Array1(2) = 0.25

Array1(3) = 0.50

Array1(4) = 0.75

Array1(5) = 0.90

Array1(6) = 1

 

'Set up color values array

Dim Array2(6) As Long

Array2(0) = grfColorAvocadoGreen

Array2(1) = RGB(127,205,49)

Array2(2) = RGB(189,199,55)

Array2(3) = grfColorLightYellow

Array2(4) = RGB(241,172,81)

Array2(5) = RGB(230,69,36)

Array2(6) = grfColorRed

 

'Set up percent stops gradient

Dim Array3(4) As Double

Array3(0) = 0

Array3(1) = 0.25

Array3(2) = 0.50

Array3(3) = 0.75

Array3(4) = 1

 

'Set up opacity values array

Dim Array4(4) As Long

Array4(0) = 100

Array4(1) = 50

Array4(2) = 25

Array4(3) = 10

Array4(4) = 10

 

'Fill the Rectangle with the custom gradient

Rectangle.Fill.Gradient.SetColorAndOpacity(Array1,Array2,Array3,Array4)

 

Used by: AutoGradient object