Optional
spring: null | Springthe Spring to display
Optional
proto: null | DisplaySpringthe prototype DisplaySpring to inherit properties from
Private
Optional
colorColor drawn when Spring is compressed to less than its rest length, a CSS3 color value.
Private
Optional
colorColor drawn when Spring is stretched to more than its rest length, a CSS3 color value.
Private
Optional
drawPrivate
Optional
thickness_Thickness of lines when drawing the Spring, in screen coordinates, so a value of 1 means a 1 pixel thick line.
Private
Optional
width_How wide back-and-forth the jagged lines go when drawing the Spring, in simulation coordinates.
Static
Readonly
JAGGEDDrawing mode constant indicating jagged line.
Static
Readonly
STRAIGHTDrawing mode constant indicating straight line.
Static
Readonly
pathThe fixed length of the un-transformed path
Static
Readonly
pathThe fixed width of the un-transformed path
Whether the DisplayObject contains the given world coordinates point.
the point in world coordinates
true
if this DisplayObject contains the given point
Draws this DisplayObject using the given CoordMap.
the canvas's context to draw this object into
the mapping to use for translating between simulation and screen coordinates
Returns the set of MassObjects that this DisplayObject represents. Returns an empty list if this DisplayObject doesn't represent a MassObject.
the set of MassObjects that this DisplayObject represents
Set the prototype DisplaySpring for this object. Display parameters are inherited from the prototype unless the parameter is explicitly set for this object.
Color drawn when Spring is compressed to less than its rest length, a CSS3 color value.
Optional
colorCompressed: stringthis object for chaining setters
Color drawn when Spring is stretched to more than its rest length, a CSS3 color value.
Optional
colorExpanded: stringthis object for chaining setters
Optional
drawMode: numberthis object for chaining setters
Sets this DisplayObject's position in simulation coordinates of the containing SimView. Each type of DisplayObject has a different policy regarding whether this will have an effect. Generally the policies are:
If the DisplayObject does not represent a SimObject, then the position can be set. Examples are DisplayClock, EnergyBarGraph.
If the SimObject's position is dependent on other objects, then the position cannot be set. Examples are DisplayConnector, DisplayRope, DisplaySpring.
If the SimObject can be moved independently and isDragable
is true
, then the position of the SimObject is modified. Example: DisplayShape.
this DisplayObject's position, in simulation coordinates.
Set the prototype DisplaySpring for this object. Display parameters are inherited from the prototype unless the parameter is explicitly set for this object.
this object for chaining setters
Thickness of lines when drawing the Spring, in screen coordinates, so a value of 1 means a 1 pixel thick line.
Optional
thickness: numberthis object for chaining setters
How wide back-and-forth the jagged lines go when drawing the Spring, in simulation coordinates.
Optional
width: numberthis object for chaining setters
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Static
drawDraws the spring using the given AffineTransform, which specifies the combination of translating, stretching, rotating the spring to its current position, and also the sim-to-screen transform. The path is drawn into a size of 6.0 long by 0.5 wide, so that when it is scaled up or down, it doesn't get too distorted.
the canvas's context to draw into
transform to apply to each point
Generated using TypeDoc
Displays a Spring. Can show either a jagged or straight line, see setDrawMode. Can have a different color when compressed or expanded, see setColorCompressed and setColorExpanded. The width determines how wide back-and-forth the jagged lines go, see setWidth.
The position is reported as the midpoint of the Spring by getPosition. The position is determined by the position of the Spring, so setPosition has no effect, and the DisplaySpring is never dragable.