Class RectGradient
represents rectangle with linear gradient
Defined in: raphaeltools.src.js.
Constructor Attributes | Constructor Name and Description |
---|---|
RectGradient(raphael, params)
Rectangle filled with gradient (as browsers does not process rotation so good).
|
Field Attributes | Field Name and Description |
---|---|
of rotation along the center of rectangle (!)
|
|
height of rectangle
|
|
rsolution of the gradient
|
|
width of rectangle
|
|
x coordinate of top left corner
|
|
y coordinate of top left corner
|
Method Attributes | Method Name and Description |
---|---|
<static> |
RectGradient.create(raphael, params)
Creates new RectGradient object, for parameters meaning see RectGradient
|
setAngle(y)
Sets new angle of receiver (this.angle = angle)
|
|
setCenter(cx, cy)
Sets new center of receiver
|
|
setColors(colors)
Sets new colors of receiver
|
|
setX(x)
Sets new x position of receiver (this.x = x)
|
|
setXY(x, y)
Sets new x and y position of receiver (this.x = x; this.y = y)
|
|
setY(y)
Sets new y position of receiver (this.y = y)
|
|
update()
Update receiver
|
Class Detail
RectGradient(raphael, params)
Rectangle filled with gradient (as browsers does not process rotation so good). Created simply as composition of lines. Works reasonably only in Google Chrome browser.
- Parameters:
- {Raphael} raphael
- rapheal instance
- {Object} params
- parameters, see below
- {float} params.x Optional, Default: 100.
- x coordinate of left lower corner [pixel]
- {float} params.y Optional, Default: 100.
- y coordinate of left lower corner [pixel]
- {float} params.width Optional, Default: 100.
- width [pixel]
- {float} params.height Optional, Default: 100.
- height [pixel]
- {float} params.angle Optional, Default: 0.
- angle of rotation along the center of rectangle (!) [deg]
- {int} params.res Optional, Default: TODO
- reslution of the gradient
- {Array} params.colors Optional, Default: TODO
- colors used in the gradient. The format is [begincolor,EndColor] or [beginColor,[color1,where],[color2,where],...,endColor]. The color format is array normalized [r,g,b], where is relative position of the color. E.g. linear gradient from blue to red [[0,0,1],[1,0,0]] or gradient from blue to red through green in one quarter [[0,0,1],[[0,1,0],0.25],[1,0,0]].
Field Detail
{float}
angle
of rotation along the center of rectangle (!)
{float}
height
height of rectangle
{int}
res
rsolution of the gradient
{float}
width
width of rectangle
{float}
x
x coordinate of top left corner
{float}
y
y coordinate of top left corner
Method Detail
<static>
{RectGradient}
RectGradient.create(raphael, params)
Creates new RectGradient object, for parameters meaning see RectGradient
- Parameters:
- raphael
- params
- Returns:
- {RectGradient} new RectGradient object
setAngle(y)
Sets new angle of receiver (this.angle = angle)
- Parameters:
- {float} y
- new y coordinate [pixel]
setCenter(cx, cy)
Sets new center of receiver
- Parameters:
- {float} cx
- new x coordinate of receiver
- {float} cy
- new y coordinate of receiver
setColors(colors)
Sets new colors of receiver
- Parameters:
- {Array} colors
- new colors of receiver, see RectGradient
setX(x)
Sets new x position of receiver (this.x = x)
- Parameters:
- {float} x
- new x coordinate [pixel]
setXY(x, y)
Sets new x and y position of receiver (this.x = x; this.y = y)
- Parameters:
- {float} x
- new x coordinate [pixel]
- {float} y
- new y coordinate [pixel]
setY(y)
Sets new y position of receiver (this.y = y)
- Parameters:
- {float} y
- new y coordinate [pixel]
update()
Update receiver