BasicCreator.prototype.getWidth()
The getWidth() method returns the line width that should be used for graphics.
The larger the scale, the thinner the body line. Use this method to get the appropriate line width for visibility and set it to Core.prototype.setStyle().
Syntax
getWidth()
Parameters
none
Return value
A positive real value representing the width of the line.
The line width is calculated from the number of divisions of the unit time of the last calculateOrbits() call. Specifically, 12 ÷ number of divisions.
max value | 1-5 | 6 | 7 | 8-9 | a-b | c-d | e-g | h-l | m-t | u-z |
---|---|---|---|---|---|---|---|---|---|---|
divisions | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 |
line width | 1 | 1.1 | 1.2 | 1.3 | 1.5 | 1.7 | 2 | 2.4 | 3 | 4 |
For example, for siteswap 3, the line width is 1. In the case of 7531, the maximum value is 7, so the line width is 1.2.
Examples
const result = jmotion.Siteswap.analyze("7531");
const table = jmotion.Siteswap.separate(result.throws, result.sync);
const creator = new jmotion.BasicCreator();
const orbits = creator.calculateOrbits(table, result.sync);
const width = creator.getWidth();
// width = 1.2