Class: grad

grad

new grad

Create a new gradient object.
grad(dst, params)
Parameters:
Name Type Description
dst Object The destination canvas.
params Array An Array of the gradient definition.
Properties:
Name Type Description
The Object destination canvas.
params Array An Array of the gradient definition.
Source:
  • codef_gradient.js, line 3
Example
	// gradient param is normalized, this example will declare 
	// Black a start
	// Blue at the 1st quarter
	// Black at the half
	// Blue at the 3rd quarter
	// then Black at the end

	var mygradcolor=[{color: 'rgb(0,0,0)' ,  offset:0},
		  	 {color: 'rgb(0,0,255)', offset:0.25},
			 {color: 'rgb(0,0,0)' ,  offset:0.5},
			 {color: 'rgb(0,0,255)', offset:0.75},
			 {color: 'rgb(0,0,0)' ,  offset:1}
			];

	var mygrad = new grad(mycanvas, mygradcolor);

Methods

<static> drawH

Draw the gradient Horizontally.
grad.drawH()
Source:
  • codef_gradient.js, line 57
Example
                mygrad.drawH();

<static> drawV

Draw the gradient Verticaly.
grad.drawV()
Source:
  • codef_gradient.js, line 79
Example
                mygrad.drawV();