Constructor Summary
| Public Constructor | ||
| public |
constructor(direction: string, color: string, width: number, border: boolean, borderWidth: number, borderColor: string) Creates a Chevron. |
|
Member Summary
| Public Members | ||
| public |
border: * |
|
| public |
borderColor: * |
|
| public |
borderWidth: * |
|
| public |
direction: * |
|
| public |
width: * |
|
Method Summary
| Public Methods | ||
| public |
Draws the Chevron division 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 Chevron. |
|
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 Chevron.
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 Chevron division on a canvas.
Params:
| Name | Type | Attribute | Description |
| ctx | object | An object containing a canvas context. |
Example:
// Draws the Chevron division on the canvas.
const chevron = new Chevron();
chevron.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 chevron = new Chevron();
chevron.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]},
// ]
const chevron = new Chevron();
const instructions = chevron.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]},
// ]
const chevron = new Chevron();
const instructions = chevron.drawInstructionsPalewise();
public generateDirection(seed: number): string source
Generate a direction value for the Chevron.
Params:
| Name | Type | Attribute | Description |
| seed | number | The seed number used for generated values. |
Example:
// Returns 'palewiseReversed'
const newChevron = new Chevron();
newPale.generateDirection(.1337)
TODO:
- Rethink the directions, use some kind of probability or something more elegant than this.