Facade()

The Facade() constructor creates a new Facade object.

Syntax

new Facade(svg)
new Facade(svg, generator)

Parameters

svg
An object representing an HTML tag, or CSS selectors.
When a Core object is created within Facade, this parameter is passed to its constructor. In addition, an Animator object is created, and this Core object is passed to it.
generator (optional)
It is a orbit generator similar to the BasicGenerator object, that will be set to Facade.prototype.generator as is.
If this argument is omitted, the CalmGenerator object is created.

Examples

const facade = new jmotion.Facade("#board");

// facade = {
//     "generator": {
//         "offset": {
//             "left": { "x": 0, "y": -10, },
//             "right": { "x": 0, "y": -10, },
//         },
//         "paths": {
//             "left": [
//                 [ path, path ],
//                 [ path, path ],
//             ],
//             "right": [
//                 [ path, path ],
//                 [ path, path ],
//             ],
//         },
//         "resolution": 1,
//         "scale": 1,
//         "width": 1,
//     },
//     "animator": {
//         "arms": [],
//         "props": [],
//         "core": {
//             "back": g#board_back,
//             "defs": defs#board_definition,
//             "front": g#board_front,
//             "middle": g#board_middle,
//             "props": [
//                 use#board_prop_0,
//                 use#board_prop_1,
//                 ...
//             ],
//             "scale": 1,
//             "svg": svg#board,
//         },
//         "index": 0,
//         "speed": 1,
//         "status": {
//             "runnable": false,
//             "running": false,
//         },
//     },
// }