Skip to content

CleanSpline

Juju Adams edited this page Mar 22, 2021 · 5 revisions

 

CleanSpline(controlPointArray, segments)

Returns: Spline struct

Name Datatype Purpose
controlPointArray array Array of x/y coordinate pairs for control points for the spline
segments integer Number of segments to use to build the spline

N.B. A shape will only draw when you call the .Draw() method. Splines tend not to cope well with very sharp angles and very short distances so be careful about the geometry you're trying to draw.

 

Splines have the following methods:

 

.Draw()

Returns: N/A (undefined)

Name Datatype Purpose
None

 

.Blend(color, alpha)

Returns: self

Name Datatype Purpose
color 24-bit color Color of the spline
alpha number Alpha value of the spline

 

.Blend2(color1, alpha1, color2, alpha2)

Returns: self

Name Datatype Purpose
color1 24-bit color Color of the start of the spline
alpha1 number Alpha value of the start of the spline
color2 24-bit color Color of the end of the spline
alpha2 number Alpha value of the end of the spline

 

.BlendExt(array)

Returns: self

Name Datatype Purpose
array array Array of color/alpha pairs to colour the spline

Multi-vertex blending uses triangle-based interpolation and can look ugly with large differences in colour. Use with caution!

 

.Thickness(pixels)

Returns: self

Name Datatype Purpose
pixels number Width of the line

 

.Cap(startType, endType)

Returns: self

Name Datatype Purpose
startType string Cap type for the start of the line, either "none", "square", "round", or "closed"
endType string Cap type for the end of the line, either "none", "square", "round", "closed"

If either cap type is "closed" then the spline will be a closed loop with no caps.

 

.Join(type)

Returns: self

Name Datatype Purpose
type string Join type, either "none", "miter", "bevel", or "round"