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 value1-5678-9a-bc-de-gh-lm-tu-z
divisions1211109876543
line width11.11.21.31.51.722.434

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