Class: PhRender

PhSim. PhRender


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
fill String

Text Fill Style

lineWidth Number

Text border line width

borderColor String

Text border color

size Number

Text size

font String

Text font

x Number
y Number
w Number
h Number
a Number
Source:

renderCircle(circle)

Render circle

Parameters:
Name Type Description
circle PhSim.Static.Circle
Source:

renderPolygon(path)

Render a a polygon.

Parameters:
Name Type Description
path Path
Source:

renderRectangle(rectangle)

Render rectangle

Parameters:
Name Type Description
rectangle PhSim.Static.Rectangle

Rectangle object

Properties
Name Type Description
sprite

Sprite Object

Source:

renderRegPolygon(regPolygon)

Parameters:
Name Type Description
regPolygon PhSim.Static.RegPolygon
Source:

renderSpriteByCenter(url, x, y, w, h, a)

Render sprite by center

Parameters:
Name Type Description
url String

URL of object loaded in PhRender.prototype.spriteImgObj

x Number

x-coordinate

y Number

y-coordinate

w Number

width

h Number

height

a Number

angle

Source:

renderStatic(obj)

Parameters:
Name Type Description
obj PhSimObject
Source:

renderStaticLayer(layer)

Parameters:
Name Type Description
layer *
Source:

setCtx(object)

Setting context That is, this function sets the globalAlpha, strokeStyle, fillStyle and lineWidth properties of the PhRender#ctx member of the PhRender object using a PhSimObject object.

Parameters:
Name Type Description
object PhSimObject
Source:

simulation(simulation)

Parameters:
Name Type Description
simulation *
Source: