Methods
-
setImgSrc(dynObject, widget)
-
Widget for changing image sources for sprites.
This:
Parameters:
Name Type Description dynObject
PhSim.DynObject widget
Object Widget Object
Properties
Name Type Description src
String New Source
- Source:
-
transformAgainstCamera(dynObject)
-
Widget to transform object by camera.
This:
Parameters:
Name Type Description dynObject
Object
Type Definitions
-
Circle
-
A circle is a set all points equidistant from some point known as the center.
In PhSim, a circle is any object
obj
such that the following are all true:obj.shape === "circle"
;typeof obj.x === number
;typeof obj.y === number
;typeof obj.radius === number
;typeof obj.cycle === number || obj.cycle
;Type:
- Source:
-
DynSimOptions
-
The options that can be used to create a dynamic simulation could be a CompositeSimulation object, a simulation object or an array of static objects.
If an array is chosen, then it is used to create
Type:
- PhSim.Static | PhSim.Static.Simulation | Array.<StaticObject>
- Source:
Properties:
Name Type Description canvas
HTMLCanvas Simulation canvas
initSimIndex
Number The inital simulation index. If undefined, the simulation index is 0.
container
HTMLElement The container
-
Layer
-
Type:
- Object
- Source:
Properties:
Name Type Description objUniverse
Array.<PhSimObjects> The array of objects.
name
String The name of the layer
-
LOAddress
-
Specify object location by layer and object indexes.
- Source:
Properties:
Name Type Description L
Number layer
O
Number object
-
LOStr
-
A Layer-Object string (LOStr) is a string specifying the layer and object indexes of an object in the DynTree.'
The form of the LOStr is:
<layer_index>,<object_index>
Type:
- String
- Source:
-
PhSimEventCall(phEvent)
-
Parameters:
Name Type Description phEvent
PhSim.Events.PhSimEvent - Source:
-
PhSimObject
-
A PhSimObject is either a static object or a dynamic object.
Type:
- Source:
-
PhSimObjectArr
-
A PhSimObject array is an array of PhSimObject objects
Type:
- Array.<PhSimObject>
- Source:
-
Polygon
-
A path is defined by vertices. They can be used as a regular polygon. Any object that contains an array of vectors and has the boolean property
path
set totrue
is reconized as a path. Paths can be used to define any polygon in general.In PhSim, a path is any object
obj
such that the following is true:Array.isArray(obj) === true
obj.shape === "polygon"
If a path is used as a polygon, it must have at least three vectors in the
verts
property.Type:
- Source:
-
Simulation
-
Type:
- Object
- Source:
Properties:
Name Type Description layers
Array.<Layer> An array of layers
world
Object World Object
simulation
Boolean Boolean indicating a simulation
widgets
WidgetOptions Array of array options
-
SLOAddress
-
Specify object location by superlayer, layer and object indexes.
- Source:
Properties:
Name Type Description S
Number superlayer
L
Number layer
O
Number object
-
StaticObject
-
Static Object Type
Type:
- Source:
Properties:
Name Type Argument Description mass
Number <optional>
The mass of the object.
density
Number <optional>
The density of the object
locked
Boolean <optional>
A boolean deterimining the lock status of the object
semiLocked
Boolean <optional>
A boolean deteriming the semi-lock status of the object
name
String <optional>
The name of the object
fillStyle
String <optional>
Fill Color
strokeStyle
String <optional>
Stroke Color
lineWidth
String <optional>
Stroke Width
sprite
PhSim.Sprites.Sprite <optional>
Sprite Object
widgets
Array <optional>
-
Vector
-
In PhSim, a vector is any object with the properties
x
andy
such that both are of the Number type.In a Circle, the
x
andy
coordinates refer to the center of the circle and the same goes for the Regular Polygon. In a Rectangle, it refers to the upper left corner of the rectangle.Type:
- PhSim.Vector | Circle | Rectangle | RegPolygon
- Source:
-
WidgetOptions
-
Type:
- WFunctionOptions | Object
- Source:
Properties:
Name Type Description type
String Name of widget.
Events
-
mousedown
-
PhSim
mousedown
event.Type: PhSim.Events.PhSimMouseEvent
- Source:
-
mousemove
-
- Source: