Description

The strokeRect() method draws a rectangle (no fill). The default color of the stroke is black.

Usage

Parameters

  • x {Integer|String} optional

    (optional) The x-coordinate of the upper-left corner of the rectangle. By default, 0.

  • y {Integer} optional

    (optional) The y-coordinate of the upper-left corner of the rectangle. By default, 0.

  • width {Integer} optional

    (optional) The width of the rectangle, in pixels. By default, width of the element.

  • height {Integer} optional

    (optional) The height of the rectangle, in pixels. By default, height of the element.

  • radius {Integer} optional

    (1.3.1) (optional) Defines a rounding on the corners of the rectangle.

Returns

CanvasEngine.Element

Example

In ready method.

Example 1 :

var el = this.createElement(100, 100);
el.strokeStyle = "red";
el.strokeRect();

Example 2 :

var el = this.createElement(100, 100);
el.strokeRect("red");

Example 3 :

var el = this.createElement(100, 100);
el.strokeRect("red", 10, 25);

Example 4 :

var el = this.createElement(100, 100);
el.strokeRect(10, 25);

Example 5 :

var el = this.createElement();
el.strokeRect(10, 25, 100, 100);

Example 6 :

var el = this.createElement();
el.strokeStyle = "red";
el.strokeRect(0, 0, 100, 100, 10);

Discussion