new PhRender(ctx)
PhRender constructor PhRender is the rendering engine for PhSim.
Parameters:
| Name | Type | Description |
|---|---|---|
ctx |
CanvasRenderingContext2D | Canvas context |
- Source:
Members
-
ctx :CanvasRenderingContext2D
-
PhRender Context
Type:
- CanvasRenderingContext2D
- Source:
-
defaultAlpha :Number
-
Default Alpha This the alpha of an object that has no alpha defined.
Type:
- Number
- Source:
-
defaultFillStyle :String
-
Default fill style This is the default fill style of an object.
Type:
- String
- Source:
-
defaultStrokeStyle :String
-
Default stroke style. This is the stroke style of an object that has no stroke style defined.
Type:
- String
- Source:
Methods
-
drawDynamicSkeleton(object)
-
Parameters:
Name Type Description object* - Source:
-
dynamicDrawLayer(L)
-
Parameters:
Name Type Description L* - Source:
-
dynamicRenderDraw(dynObject)
-
Parameters:
Name Type Description dynObject* - Source:
-
dynamicSkeleton(object)
-
Parameters:
Name Type Description object* - Source:
-
dynamicSkeleton_center(object)
-
Parameters:
Name Type Description object* - Source:
-
rectText(text, x, y, w, h, a)
-
Parameters:
Name Type Description text* Properties
Name Type Description fillString Text Fill Style
lineWidthNumber Text border line width
borderColorString Text border color
sizeNumber Text size
fontString Text font
xNumber yNumber wNumber hNumber aNumber - Source:
-
renderCircle(circle)
-
Render circle
Parameters:
Name Type Description circlePhSim.Static.Circle - Source:
-
renderPolygon(path)
-
Render a a polygon.
Parameters:
Name Type Description pathPath - Source:
-
renderRectangle(rectangle)
-
Render rectangle
Parameters:
Name Type Description rectanglePhSim.Static.Rectangle Rectangle object
Properties
Name Type Description spriteSprite Object
- Source:
-
renderRegPolygon(regPolygon)
-
Parameters:
Name Type Description regPolygonPhSim.Static.RegPolygon - Source:
-
renderSpriteByCenter(url, x, y, w, h, a)
-
Render sprite by center
Parameters:
Name Type Description urlString URL of object loaded in PhRender.prototype.spriteImgObj
xNumber x-coordinate
yNumber y-coordinate
wNumber width
hNumber height
aNumber angle
- Source:
-
renderStatic(obj)
-
Parameters:
Name Type Description objPhSimObject - Source:
-
renderStaticLayer(layer)
-
Parameters:
Name Type Description layer* - Source:
-
setCtx(object)
-
Setting context That is, this function sets the
globalAlpha,strokeStyle,fillStyleandlineWidthproperties of the PhRender#ctx member of the PhRender object using a PhSimObject object.Parameters:
Name Type Description objectPhSimObject - Source:
-
simulation(simulation)
-
Parameters:
Name Type Description simulation* - Source: