Core.prototype.setProps()

The setProps() method sets the graphic elements of the props list. The middle layer is used.

prop0 prop1 prop2

Any graphic elements that can be set in the <svg> tag will be added to Core.prototype.defs in the specified order. However, at the moment no drawing has been done yet, and for that you need to call drawProps() method. That method internally creates SVGUseElement objects (<use> tag) for the number of props, and sequentially references the elements specified here. When there are no more elements to reference, it starts over and uses the same elements in order.

Syntax

setProps(elements)

Parameters

elements
An array of graphic elements.

Return value

none

Examples

const core = new jmotion.Core("#board", true);
const elements = [
    document.getElementById("ball"),
    document.getElementById("ring"),
    document.getElementById("club"),
];
core.setProps(elements);

// core.defs = {
//     "ball": circle#ball,
//     "club": rect#club,
//     "ring": circle#ring,
// }