Core.prototype.setHands()

The setHands() method sets hand graphic elements. By default, the front layer is used.

hand0 hand1

Both hands are expected to be SVGUseElement objects (<use> tags). If you specify a different graphic element, the specified element is added to Core.prototype.defs and an SVGUseElement object referencing it is created internally and added to the drawing layer.

The hands to be moved by drawArms() must be set in advance by this method.

Syntax

setHands(elements)
setHands(elements, layer)

Parameters

elements
An array of graphic elements.
layer (Optional)
A drawing layer on which to place graphic elements.
If this argument is omitted, the graphic elements are placed on Core.prototype.front.
In either case, existing hand elements are deleted.

Return value

none

Examples

const core = new jmotion.Core("#board", true);
const elements = [
    document.getElementById("hand"),
];
core.setHands(elements);

// core.front = {
//     "board_hand_use": use#board_hand_use,
// }