opacity

Gets or sets the element opacity. Inherited from Element.opacity

If set, the stroke and fill opacity will be multiplied by the element opacity.

Example

<div id="surface" style="width: 250px; height: 250px;"></div>
<script>
    var draw = kendo.drawing;

    var path = new draw.Path({
        fill: {
            color: "#2ecc71"
        },
        stroke: {
            color: "#27ae60",
            width: 2
        }
    })
    .moveTo(50, 50)
    .lineTo(200, 50)
    .lineTo(125, 200)
    .close();

    // Set opacity using the opacity method
    path.opacity(0.5);

    console.log("Current opacity:", path.opacity());

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

Parameters

opacity Number

The element opacity. Ranges from 0 (completely transparent) to 1 (completely opaque).

Returns

Number The current element opacity.

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