CalmGenerator()

The CalmGenerator() constructor creates a new CalmGenerator object.

When an object is created, properties are set to default values. CalmGenerator.prototype.paths is set to a list of cubic Bezier curves for each joint orbit.

(-90, 10) (-90, 37) (-30, 10) (-30, 37)

A cubic Bezier curve has four coordinates: a start point, an end point, and corresponding control points. For example, in the orbit of the right hand "catch-to-throw" has (-90, 10), (-90, 37), (-30, 37), and (-30, 10). A total of 8 Bezier curves (SVGPathElement objects representing them) are set as shown in the table below.

armdirectionjointorbit overview
rightcatch-to-throwhandbottom half of large ellipse from right to left
elbowbottom half of small ellipse from right to left
throw-to-catchhandtop half of large ellipse from left to right
elbowtop half of small ellipse from left to right
leftcatch-to-throwhandbottom half of large ellipse from left to right
elbowbottom half of small ellipse from left to right
throw-to-catchhandtop half of large ellipse from right to left
elbowtop half of small ellipse from right to left

Note that these are approximate representations of ellipses, not exact ellipses.

Syntax

new CalmGenerator()
new CalmGenerator(resolution)

Parameters

resolution (optional)
This is the resolution used when calling calculateOrbits(). This value will be set to CalmGenerator.prototype.resolution as is.
If a value of 0 or less is specified, or if this argument is omitted, it is set to 1.

Examples

const generator = new jmotion.CalmGenerator();

// 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,
// }