404 lines
7.4 KiB
Markdown
Raw Permalink Normal View History

2021-05-06 15:35:56 -07:00
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Testbed](testbed.md)
# Interface: Testbed
## Hierarchy
* **Testbed**
## Index
### Properties
* [activeKeys](testbed.md#activekeys)
* [background](testbed.md#background)
* [findAll](testbed.md#findall)
* [findOne](testbed.md#findone)
* [height](testbed.md#height)
* [hz](testbed.md#hz)
* [keydown](testbed.md#optional-keydown)
* [keyup](testbed.md#optional-keyup)
* [mouseForce](testbed.md#optional-mouseforce)
* [ratio](testbed.md#ratio)
* [scaleY](testbed.md#scaley)
* [speed](testbed.md#speed)
* [step](testbed.md#optional-step)
* [width](testbed.md#width)
* [x](testbed.md#x)
* [y](testbed.md#y)
### Methods
* [color](testbed.md#color)
* [drawAABB](testbed.md#drawaabb)
* [drawCircle](testbed.md#drawcircle)
* [drawPoint](testbed.md#drawpoint)
* [drawPolygon](testbed.md#drawpolygon)
* [drawSegment](testbed.md#drawsegment)
* [info](testbed.md#info)
* [status](testbed.md#status)
## Properties
### activeKeys
• **activeKeys**: *[ActiveKeys](activekeys.md)*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:87](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L87)*
2021-05-06 15:35:56 -07:00
___
### background
• **background**: *string*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:88](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L88)*
2021-05-06 15:35:56 -07:00
___
### findAll
• **findAll**: *function*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:109](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L109)*
2021-05-06 15:35:56 -07:00
#### Type declaration:
▸ (`query`: string): *[Body](../classes/body.md)[] | [Joint](../classes/joint.md)[] | [Fixture](../classes/fixture.md)[]*
**Parameters:**
Name | Type |
------ | ------ |
`query` | string |
___
### findOne
• **findOne**: *function*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:108](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L108)*
2021-05-06 15:35:56 -07:00
#### Type declaration:
▸ (`query`: string): *[Body](../classes/body.md) | [Joint](../classes/joint.md) | [Fixture](../classes/fixture.md) | null*
**Parameters:**
Name | Type |
------ | ------ |
`query` | string |
___
### height
• **height**: *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:73](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L73)*
2021-05-06 15:35:56 -07:00
World viewbox height.
___
### hz
• **hz**: *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:83](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L83)*
2021-05-06 15:35:56 -07:00
World simulation step frequency
___
### `Optional` keydown
• **keydown**? : *function*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:105](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L105)*
2021-05-06 15:35:56 -07:00
#### Type declaration:
▸ (`keyCode`: number, `label`: string): *void*
**Parameters:**
Name | Type |
------ | ------ |
`keyCode` | number |
`label` | string |
___
### `Optional` keyup
• **keyup**? : *function*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:106](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L106)*
2021-05-06 15:35:56 -07:00
#### Type declaration:
▸ (`keyCode`: number, `label`: string): *void*
**Parameters:**
Name | Type |
------ | ------ |
`keyCode` | number |
`label` | string |
___
### `Optional` mouseForce
• **mouseForce**? : *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:90](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L90)*
2021-05-06 15:35:56 -07:00
___
### ratio
• **ratio**: *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:80](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L80)*
2021-05-06 15:35:56 -07:00
___
### scaleY
• **scaleY**: *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:79](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L79)*
2021-05-06 15:35:56 -07:00
___
### speed
• **speed**: *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:85](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L85)*
2021-05-06 15:35:56 -07:00
World simulation speed, default is 1
___
### `Optional` step
• **step**? : *function*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:104](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L104)*
2021-05-06 15:35:56 -07:00
#### Type declaration:
▸ (`dt`: number, `t`: number): *void*
**Parameters:**
Name | Type |
------ | ------ |
`dt` | number |
`t` | number |
___
### width
• **width**: *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:71](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L71)*
2021-05-06 15:35:56 -07:00
World viewbox width.
___
### x
• **x**: *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:75](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L75)*
2021-05-06 15:35:56 -07:00
World viewbox center vertical offset.
___
### y
• **y**: *number*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:77](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L77)*
2021-05-06 15:35:56 -07:00
World viewbox center horizontal offset.
## Methods
### color
▸ **color**(`r`: number, `g`: number, `b`: number): *string*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:101](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L101)*
2021-05-06 15:35:56 -07:00
**Parameters:**
Name | Type |
------ | ------ |
`r` | number |
`g` | number |
`b` | number |
**Returns:** *string*
___
### drawAABB
▸ **drawAABB**(`aabb`: [AABB](../classes/aabb.md), `color`: string): *void*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:100](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L100)*
2021-05-06 15:35:56 -07:00
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](../classes/aabb.md) |
`color` | string |
**Returns:** *void*
___
### drawCircle
▸ **drawCircle**(`p`: object, `r`: number, `color`: string): *void*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:97](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L97)*
2021-05-06 15:35:56 -07:00
**Parameters:**
▪ **p**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
▪ **r**: *number*
▪ **color**: *string*
**Returns:** *void*
___
### drawPoint
▸ **drawPoint**(`p`: object, `r`: any, `color`: string): *void*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:96](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L96)*
2021-05-06 15:35:56 -07:00
**Parameters:**
▪ **p**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
▪ **r**: *any*
▪ **color**: *string*
**Returns:** *void*
___
### drawPolygon
▸ **drawPolygon**(`points`: Array‹object›, `color`: string): *void*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:99](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L99)*
2021-05-06 15:35:56 -07:00
**Parameters:**
Name | Type |
------ | ------ |
`points` | Array‹object› |
`color` | string |
**Returns:** *void*
___
### drawSegment
▸ **drawSegment**(`a`: object, `b`: object, `color`: string): *void*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:98](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L98)*
2021-05-06 15:35:56 -07:00
**Parameters:**
▪ **a**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
▪ **b**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
▪ **color**: *string*
**Returns:** *void*
___
### info
▸ **info**(`text`: string): *void*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:94](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L94)*
2021-05-06 15:35:56 -07:00
**Parameters:**
Name | Type |
------ | ------ |
`text` | string |
**Returns:** *void*
___
### status
▸ **status**(`name`: string, `value`: any): *void*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:92](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L92)*
2021-05-06 15:35:56 -07:00
**Parameters:**
Name | Type |
------ | ------ |
`name` | string |
`value` | any |
**Returns:** *void*
▸ **status**(`value`: object | string): *void*
2021-05-11 18:30:36 -07:00
*Defined in [testbed/index.ts:93](https://github.com/shakiba/planck.js/blob/acc3bd8/testbed/index.ts#L93)*
2021-05-06 15:35:56 -07:00
**Parameters:**
Name | Type |
------ | ------ |
`value` | object | string |
**Returns:** *void*