sb.polyString

sb.polyString(x_values, y_values)

or

sb.polyString({{x:, y:}, ...})

This is a higher performance function for generating a polygon string based on a set of numeric data points maintained in JS arrays.In the two argument form, the function receives as inputs two JS arrays whose content represents the numeric x and y data points to be converted to a string.In the single argument form, the function receives as input a single JS array whose content are objects with an "x" and "y" member values.The string returned is designed to be compatible with the Storyboard polygon plugin and is in the form of X1:Y1 X1:Y2 ...

Parameters:    
    x_values - An array containing numeric data for the x points    
    y_values - An array containing numeric data for the y points    
    xy_values - A array of objects where each object contains x and y members specifying the x and y points.  Used instead of x_values and y_values

 Returns: 
     A string that contains the x and y points in a format that can be used to set a data variable

Example:

// Create a triangle polygon in a 100x100 square
const x_points = { 0, 50, 100 }; 
// Left, Middle, Right
const y_points = { 100, 0, 100 }; 
// Bottom, Top, Bottom
var x_y_string = sb.polyString(x_points, y_points);
print("X Y String: " + x_y_string);

// Create the same triangle, but with x,y member variables
const xy_points = [{x:0,y:100}, {x:50,y:0}, {x:100,y:100}];
var xy_string = sb.polyString(xy_points);
print("XY String: " + xy_string);
Was this article helpful?
0 out of 0 found this helpful