Namespace: Widgets

PhSim. Widgets

Widget Namespace.

Mixes In:
Source:

Methods


<static> circularConstraint(dyn_object, widget)

The circularConstraint widget creates circular constraints.

A circular constraint is a special kind of constraint that is made up of an object dyn_object and a point (x,y) in space.

The object rotates around the centroid of dyn_object as it rotates around the point (x,y).

Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget Object

Circular Constraint options

Properties
Name Type Description
x Number

x-coordinate of the other end of the constraint

y Number

y-coordinate of the other end of the constraint

Source:

<static> clone(dyn_object, widget)

The clone widget is a widget that makes copies of an object and inserts them into the simulation.

Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget WFunctionOptions

Options.

Source:

<static> constraint(phsim, widget)

Constraint Widget

Parameters:
Name Type Description
phsim PhSim
widget Object

Widget Options

Properties
Name Type Argument Default Description
objectA LOAddress | PhSim.DynObject <optional>

Object A - First point.

objectB LOAddress | PhSim.DynObject <optional>

Object B - Second Point

pointA Vector <optional>

First point (see widget.position for more information)

pointB Vector <optional>

Second point (see widget.position for more information)

position "relative" | "absolute" <optional>
"absolute"

Positions of points.

If set to "relative", then the rules for positioning a point is the following:

  • If widget.objectA is set, then widget.pointA defines the offset from the centroid of widget.objectA. Otherwise, the point is set to a point in the phsim space.

  • If widget.objectB is set, then widget.pointB defines the offset from the centroid of widget.objectB. Otherwise, the point is set to a point in the phsim space.

Note: If one is familar with Matter.js, then the rules are simular to rules of making a constraint are simular to those in Matter.js.

If set to "absolute", then the rules for positioning a point is that the points are set to points in space. This is the default value.

Source:

<static> deleteSelf(dyn_object, widget)

The deleteSelf widget makes an object delete itself from the simulation.

Parameters:
Name Type Description
dyn_object PhSim.DynObject

The Dynamic Object to be configured.

widget WFunctionOptions

Configuration options

Source:

<static> draggable(dyn_object, widget)

The draggable widget makes PhSim.DynObject objects draggable.

This:
Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget *
Source:

<static> elevator(dyn_object, widget)

The elevator widget makes objects go back and forth within some range.

Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget Object

Options

Properties
Name Type Description
pointA Vector

First point of the elevator

pointB Vector

Second point of the elevator

bounding "x" | "y"

Rules for deteriming the range of the elevator.

If widget.bounding is equal to "x", then the elevator switches direction if the x value of the position of dyn_object is equal to widget.pointA.x or widget.pointB.x.

If widget.bounding is equal to "y", then the elevator switches direction if the y value of the position of dyn_object is equal to widget.pointA.y or widget.pointB.y.

Source:

<static> force(dyn_object, widget)

The force widget exerts a force on an object

Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget WFunctionOptions
Source:

<static> noRotation(dyn_object, widget)

Make object not rotate

Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget *
Source:

The objLink widget executes all functions in the PhSim.DynObject#objLinkFunctions array of widget.target.

Parameters:
Name Type Description
dyn_object PhSim.DynObject

Reciever Object

widget WFunctionOptions

Widget options

Properties
Name Type Description
target LOAddress | PhSim.DynObject

Target object

Source:

<static> playAudio(dyn_object, widget)

PlayAudio Widget

This:
Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget Object
Source:

<static> position(dynObject, widget)

The position widget sets the position of an object.

This:
Parameters:
Name Type Description
dynObject PhSim.DynObject

Dynamic object that will have its position changed.

widget WFunctionOptions

Widget options.

Source:

<static> rectText(dyn_object)

Widget that sets the PhSim.DynObject#rectTextWidget as true.

Parameters:
Name Type Description
dyn_object PhSim.DynObject
Source:

<static> rotation(dynObject, widget)

The rotation widget rotates an object.

This:
Parameters:
Name Type Description
dynObject PhSim.DynObject
widget WFunctionOptions
Source:

<static> setAngle(dynObject, widget)

The setAngle widget makes a widget change angle.

Parameters:
Name Type Description
dynObject PhSim.DynObject

Dynamic Object

widget WFunctionOptions
Source:

<static> setBorderColor(dyn_object, widget)

The setBorderColor widget sets the border color of an object.

Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget WFunctionOptions

Widget properties.

Properties
Name Type Description
color String

The new color of the object border

Source:

<static> setColor(dyn_object, widget)

The setColor widget changes the color of an object. It utlizies the PhSim.DynObject.setColor function.

Parameters:
Name Type Description
dyn_object PhSim.DynObject

Dynamic Object that will have it's color changed.

widget WFunctionOptions

Widget Options

Properties
Name Type Description
color String

The new color of the object.

Source:

<static> setLineWidth(dyn_object, widget)

The setLineWidth widget sets the line width of an object.

Parameters:
Name Type Description
dyn_object PhSim.DynObject

The object to be affected.

widget WFunctionOptions

Widget options

Properties
Name Type Description
width Number

New line width

Source:

<static> stack(o, w)

This:
Parameters:
Name Type Description
o DynSimObject
w Object

Widget Options

Properties
Name Type Description
rows Number

Widget Rows

rowDist Number

Distance between two adjacent objects in a row

columns Number

Columns

colDist Number

Distance between two adjecent objects in the column

Source:

<static> toggleLock(dyn_object, widget)

The toggleLock widget toggles the lock status of the Dynamic Object. If locked, the object is unlocked. If unlocked, the object is locked.

Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget WFunctionOptions

Configuration

Source:

<static> toggleSemiLock(dyn_object, widget)

The toggleSemiLock widget toggles the semi-lock status of the Dynamic Object. If semi-locked, the object is semi-unlocked. If semi-unlocked, the object is semi-locked.

Parameters:
Name Type Description
dyn_object PhSim.DynObject
widget WFunctionOptions

Configuration

Source:

<static> transformCameraByObj(dyn_object)

The transformCameraByObj widget transforms the camera by an object.

This:
Parameters:
Name Type Description
dyn_object PhSim.DynObject

Object that will transform object.

Source:

<static> translate(dynObject, widget)

The translate widget moves objects.

This:
Parameters:
Name Type Description
dynObject PhSim.DynObject

Dynamic Object to be translated.

widget WFunctionOptions

Widget options.

Properties
Name Type Description
vector Vector

Translation vector

Source:

<static> velocity(dynObject, widget)

The velocity widget makes dynamic objects go at a certain velocity.

This:
Parameters:
Name Type Description
dynObject PhSim.DynObject
widget WFunctionOptions
Properties
Name Type Description
vector Vector

Velocity vector

Source:

<static> wFunction(o, widget)

The wFunction widget is used to create wFunctions.

Parameters:
Name Type Description
o PhSim.DynObject | PhSim

Target object or simulation

widget WFunctionOptions

wFunction options

Source: