Core.prototype.drawArms()

The drawArms() method draws all arms given a list of coordinates.

p2 p1 p0 q2 q1 q0

Specify as many coordinates as the number of joints for each arm. They are used to draw already registered graphic elements.

If the coordinates of the right wrist-to-shoulder joint are p0, p1, p2, and the coordinates of the left arm are q0, q1, q2, the coordinate list will be an array of arrays as follows.

[
    [ p0, p1, p2 ],
    [ q0, q1, q2 ],
]

A coordinate is a DOMPoint-like object with x and y properties.

{ "x": 0, "y": 0 }

If you don't use the default graphic elements and set them with setArms() or setHands(), the arms will be in the order specified by those methods. Specify the desired number of coordinates if the number of arms or joints is different from the default.

[
    [ p0, p1, p2, p3, ... ],
    [ q0, q1, q2, q3, ... ],
    [ r0, r1, r2, r3, ... ],
    ...
]

The palm coordinates are the same as the wrist coordinates (p0 and q0). If the last joint, such as the shoulder, does not move, its coordinates can be omitted.

Syntax

drawArms(arms)

Parameters

arms
An array of arrays of joint coordinates for each arm.

Return value

none

Examples

const core = new jmotion.Core("#board");
const arms = [
    [
        { "x": -70, "y": -210 },
        { "x": -90, "y": -130 },
    ],
    [
        { "x": 70, "y": 20 },
        { "x": 90, "y": -50 },
    ],
];
core.drawArms(arms);