center
Gets or sets the center point of the gradient.
Example
<div id="surface" />
<script>
var draw = kendo.drawing;
var geom = kendo.geometry;
var gradient = new draw.RadialGradient({
center: [0.3, 0.3],
radius: 0.5,
stops: [
{ offset: 0, color: "#ff6600", opacity: 1 },
{ offset: 1, color: "#ff0066", opacity: 0.3 }
]
});
// Get current center
var currentCenter = gradient.center();
console.log("Current center:", currentCenter.x, currentCenter.y);
// Set new center
gradient.center([0.7, 0.7]);
console.log("New center set to bottom-right area");
var rect = new geom.Rect([0, 0], [150, 100]);
var path = draw.Path.fromRect(rect, {
stroke: null,
fill: gradient
});
var surface = draw.Surface.create($("#surface"));
surface.draw(path);
</script>
Parameters
center Array|kendo.geometry.Point
The center point of the gradient.
Coordinates are relative to the shape bounding box. For example [0, 0] is top left and [1, 1] is bottom right.
Returns
kendo.geometry.Point
The current radius of the gradient.
In this article