radius

Gets or sets the radius of the gradient.

Example

<div id="surface" />
<script>
  var draw = kendo.drawing;
  var geom = kendo.geometry;

  var gradient = new draw.RadialGradient({
    center: [0.5, 0.5],
    radius: 0.4,
    stops: [
      { offset: 0, color: "#66ff00", opacity: 1 },
      { offset: 1, color: "#006600", opacity: 0.4 }
    ]
  });

  // Get current radius
  var currentRadius = gradient.radius();
  console.log("Current radius:", currentRadius);

  // Set new radius
  gradient.radius(0.8);
  console.log("Radius expanded to 0.8");

  var rect = new geom.Rect([0, 0], [130, 90]);
  var path = draw.Path.fromRect(rect, {
    stroke: { color: "#999", width: 1 },
    fill: gradient
  });

  var surface = draw.Surface.create($("#surface"));
  surface.draw(path);
</script>

Parameters

value Number

The new radius of the gradient.

Returns

Number The current radius of the gradient.

In this article
radius
Not finding the help you need?
Contact Support