Constructor Summary
| Public Constructor | ||
| public |
constructor(direction: string, color: string, width: number, border: boolean, borderWidth: number, borderColor: string) Creates a Pall. |
|
Member Summary
| Public Members | ||
| public |
border: * |
|
| public |
borderColor: * |
|
| public |
borderWidth: * |
|
| public |
direction: * |
|
| public |
width: * |
|
Method Summary
| Public Methods | ||
| public |
Draws the Pall pattern on a canvas. |
|
| public |
drawInstructions(direction: string): Function Returns the proper draw function instructions for a given direction. |
|
| public |
drawInstructionsFesswise(reversed: boolean): Array Generates the draw instructions for the fesswise and fesswiseReversed directions. |
|
| public |
drawInstructionsPalewise(reversed: boolean): Array Generates the draw instructions for the palewise and palewiseReversed directions. |
|
| public |
generateDirection(seed: number): string Generate a direction value for the Pall. |
|
Inherited Summary
| From class Division | ||
| public |
color: * |
|
| public |
count: * |
|
| public |
limit: * |
|
| public |
seed: * |
|
| public |
|
|
Public Constructors
public constructor(direction: string, color: string, width: number, border: boolean, borderWidth: number, borderColor: string) source
Creates a Pall.
Override:
Division#constructorParams:
| Name | Type | Attribute | Description |
| direction | string | The orientation of the Pall. One of: fesswise, palewise, fesswiseReversed, palewiseReverse. |
|
| color | string | A hexadecimal color string. |
|
| width | number | A width value for drawing the division. |
|
| border | boolean | Whether or not to draw a border around the Pall. |
|
| borderWidth | number | The width of the border. |
|
| borderColor | string | A hexadecimal color string. |
Example:
// Creates a horizontally oriented, white Pall with a black border.
const pall = new Pall('fesswise', '#ffffff', true, 20, '#000000');
Public Members
public border: * source
public borderColor: * source
public borderWidth: * source
public direction: * source
public width: * source
Public Methods
public draw(ctx: object) source
Draws the Pall pattern on a canvas.
Params:
| Name | Type | Attribute | Description |
| ctx | object | An object containing a canvas context. |
Example:
// Draws the Pall pattern.
pall.draw(ctx);
public drawInstructions(direction: string): Function source
Returns the proper draw function instructions for a given direction.
Params:
| Name | Type | Attribute | Description |
| direction | string | One of: 'fesswise', 'palewise', 'fesswiseReversed', 'palewiseReversed'. |
Example:
// Returns drawInstructionsPalewise();
const pall = new Pall();
pall.drawInstructions('palewise');
public drawInstructionsFesswise(reversed: boolean): Array source
Generates the draw instructions for the fesswise and fesswiseReversed directions.
Params:
| Name | Type | Attribute | Description |
| reversed | boolean | Whether or not to return the reverse draw instructions. |
Example:
// Returns an instruction set for the fesswise direction based on the flag dimensions.
// [
// {moveTo: [x, y]},
// {lineTo: [x, y]},
// {lineTo: [x, y]},
// {moveTo: [x, y]},
// {lineTo: [x, y]},
// ]
const pall = new Pall();
const instructions = pall.drawInstructionsFesswise();
public drawInstructionsPalewise(reversed: boolean): Array source
Generates the draw instructions for the palewise and palewiseReversed directions.
Params:
| Name | Type | Attribute | Description |
| reversed | boolean | Whether or not to return the reverse draw instructions. |
Example:
// Returns an instruction set for the palewise direction based on the flag dimensions.
// [
// {moveTo: [x, y]},
// {lineTo: [x, y]},
// {lineTo: [x, y]},
// {moveTo: [x, y]},
// {lineTo: [x, y]},
// ]
const pall = new Pall();
const instructions = pall.drawInstructionsPalewise();