Animations
The animation of assets in a factory model can be defined according to the JSON schema described in this section. JSON (JavaScript Object Notation) is a lightweight text-based data-interchange format that is easy to read/parse and write/generate both for humans and machines. A .json file can be opened with any basic or advanced text editor (e.g. NotePad++, Visual Studio Code).

Schema

The schema is composed of three root properties:
  • context”: set of properties of initial setup for the whole animation
  • "nodes": an array defining what happens during the animation
  • "bookmarks": an array defining bookmarks
The “context” is characterized by the following set of properties:
  • "UnitOfMeasureScale": (optional) unit of measure scale (e.g. 0.01 stands for centimeter, whereas 1 stands for meter). If not defined, then the unit of measure of the associated scene is adopted.
  • "assetTrail": value set to true if trails (red lines) must be shown to track the movements of moving assets, false otherwise to hide all trails.
  • "Repo3dModel": Path of the repository where the 3D models can be found. Repo3dModel can be defined as absolute or as relative to the application path. The file path of 3D models is defined relatively to Repo3dModel (e.g. '/repository/', 'https://example.com/datarepository/').
  • "RepoAnim": Path of the repository where the animation sequences can be found. RepoAnim can be defined as absolute or as relative to the application path. The file path of animation sequences is defined relatively to RepoAnim (e.g. '/repository/', 'https://example.com/datarepository/').
Each item in the “nodes” array contains the following properties (all required):
  • "id": unique identifier of the asset that is characterized in terms of animation [required]
  • "actions": array of actions that are relevant for the animation
Each item in the “actions” array contains the following properties (all required?):
  • "trigger": specifying when the action takes place with properties “type” and “data
  • "event": specifying what action takes place with properties “type” and “data
Possible values for “type” of “trigger”:
  • "timestamp": the value in “data” is interpreted as time in milliseconds after the start of animation
Possible values for “type” of “event”:
  • "animation": animation of the asset starts. The value of “data” property is interpreted as the path of the file (.bin or .txt) defining the animation sequence. The positions and rotations are defined in absolute terms, but if the additional property “placementRelTo” is defined then it must be intended in relative terms.
  • "animationAdditive": animation of the asset starts. The value of “data” property is interpreted as the path of the file (.bin or .txt) defining the animation sequence. The animation is intended as additive (incremental) with respect to the current placement (position, rotation) of the asset.
  • show”: the asset is shown in the scene. The place where the asset appears is defined with additional properties (as for the scene definition): "position" (default value [0.0,0.0,0.0]), “scale" (default value [1.0,1.0,1.0]), "rotation" (default value [0.0,0.0,0.0] Euler angles YXZ in radians), "placementRelTo". For instance, if only "placementRelTo" is defined, then position, scale and rotation have default values.
  • attach”: the asset keeps its absolute position, rotation and scale, but its location in the scene graph is updated according to the value of property "placementRelTo". If "placementRelTo" is empty or not defined, then the asset is attached to the root node in the scene graph.
  • hide”: the asset is hidden from the scene
  • state”: the asset changes its state in terms of 3D representation and description. The state is specified by the following properties, all optional:
    • data” property is a string with the file path of the 3D representation file (e.g. .obj). The new 3D representation completely replace the (possibly) existing mesh while inheriting its attributes (e.g. position, rotation, scaling).
    • "descr" is a string with the description of the current state. This description is incremental and does not replace the static description of the asset.
  • link”: link to a (text) file that is specified by the following properties:
    • data” is a string with the local file path
    • "descr" is a string with the description of the content that is found at the link
    • URL” is the address where the file can be downloaded from
  • trail”: setting the visualization of the trail (red line) to track movements of the specific asset with the following property.
    • value” is a boolean set to true if the trail generation is started, false if the trail generation is stopped.

Animation sequence

The animation (“animation” or “animationAdditive”) sequence is defined in a .txt file as a list of numerical values to be interpreted as follows:
  • The first line defines the total number of frames (N) in the file.
  • The second line defines the FPS (frame per second).
  • Lines from 3 till N+2 define the position in the 3D space for each frame.
  • Lines from N+3 till 2*N+2 define the rotation (as Euler angles YXZ in radians or alternatively as quaternion for "animation" and axis-angle for "animationAdditive") in the 3D space for each frame.

Examples

Examples of animation instantiated in a JSON file are available together with the corresponding JSON file instantiating the scene and assets. Animations can be played in VEB.js.
Last modified 1mo ago