Rect.addY

Syntax

addY(y: Number);

Parameters

y. Extension value.

Description

The addY method extends a rectangle vertically for a specified value.

Example

To execute the example, add a link to PP.js scenario file to HTML page in the <head> tag. The following code is executed in the console browser. Create a rectangle 10 pixels high and wide, the top left corner of which has the coordinates (10, 10).

// Create a rectangle
var rect = new PP.Rect("10,10,10,10");

Extend the rectangle up and down by 5 pixels:

// Extend the rectangle
rect.addY(5);
// Output value of rectangle's top left corner coordinate and rectangle's height
console.log('The Y coordinate of rectangle's top left corner: ' + rect.getTop());
console.log('Rectangle's height: ' + rect.getHeight());

As a result, the console displays values of the Y coordinate of rectangle's top left corner and rectangle's height:

The Y coordinate of rectangle's top left corner: 5

Rectangle's height: 15

See also:

Rect