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.
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.
| arm | direction | joint | orbit overview |
|---|---|---|---|
| right | catch-to-throw | hand | bottom half of large ellipse from right to left |
| elbow | bottom half of small ellipse from right to left | ||
| throw-to-catch | hand | top half of large ellipse from left to right | |
| elbow | top half of small ellipse from left to right | ||
| left | catch-to-throw | hand | bottom half of large ellipse from left to right |
| elbow | bottom half of small ellipse from left to right | ||
| throw-to-catch | hand | top half of large ellipse from right to left | |
| elbow | top 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,
// }