BasicCreator.prototype.getScale()
The getScale() method returns the scale that should be used for graphics.
The default scale of 1 only shows around the body, even when throwing a lot of props. Use this method to get the appropriate scale for all props to display and set it to Core.prototype.setScale().
Syntax
getScale()
Parameters
none
Return value
A positive real value representing the scale.
The scale is calculated with the maximum height (absolute value) contained in the arguments of the last calculateOrbits() call.
max value | 1-5 | 6-z |
---|---|---|
scale | 1 | (max value - 1) ÷ 4 |
If the maximum value is 5 or less, the scale is always 1. If the maximum value is 6 or greater, for example 7, then (7 - 1) ÷ 4 = 1.5.
Examples
const result = jmotion.Siteswap.analyze("7");
const table = jmotion.Siteswap.separate(result.throws, result.sync);
const creator = new jmotion.BasicCreator();
const orbits = creator.calculateOrbits(table, result.sync);
const scale = creator.getScale();
// scale = 1.5