Class: JSyncLink

physics.JSyncLink(from, to, syncPropsopt, valueModifiersopt, syncCallbackopt)

Represents a relationship between a display object and a `matter.js` physics body.
- Primarily used for storage.
- Created, stored and managed in the `JRender` Class.

Constructor

This constructor is handled by `JRender.addSyncLink()` in most cases.
Parameters:
Name Type Attributes Default Description
from Matter.Body Physics body (the leader).
to PIXI.DisplayObject Display object (the follower).
syncProps JRender.SyncProps <optional>
null Which properties to sync.
valueModifiers JRender.SyncValueModifiers <optional>
null Sync value modfiers.
syncCallback JRender.SyncCallback <optional>
null Optional function to call after each sync.
Source:
Example
this.jrender.link.ball_0.autoSync = false;
this.jrender.link.ball_0.from.isStatic = true;

Members

data :Object

An object where any additional data can be defined for later reference.
Type:
  • Object
Source:

from :Matter.Body

Physics body (the leader).
Type:
  • Matter.Body
Source:

syncCallback :JRender.SyncCallback

Optional function to call after each sync.
Type:
  • JRender.SyncCallback
Source:

syncEnabled :boolean

Whether syncing is enabled. Default is true.
Type:
  • boolean
Source:

syncProps :JRender.SyncProps

Which properties to sync.
Type:
  • JRender.SyncProps
Source:

to :PIXI.DisplayObject

Display object (the follower).
Type:
Source:

valueModifiers :JRender.SyncValueModifiers

Sync value modfiers.
Type:
  • JRender.SyncValueModifiers
Source:

Methods

dispose()

Manually removes data from the sync link.
- This method is called by `JRender` when it is manually disposed.
Source: