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 - setting and getting opacity

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

    var multiPath = new draw.MultiPath()
        .moveTo(50, 50).lineTo(150, 50).lineTo(100, 100).close()
        .moveTo(100, 150).lineTo(200, 150).lineTo(150, 200).close();

    multiPath.fill("blue").stroke("red", 2);

    // Set opacity to 50%
    multiPath.opacity(0.5);
    
    // Get current opacity
    console.log("Current opacity: " + multiPath.opacity());

    var surface = draw.Surface.create($("#surface"));
    surface.draw(multiPath);
</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