curve_tightness()#

Modifies the quality of forms created with curve() and curve_vertex().

Examples#

 1# move the mouse left and right to see the curve change
 2
 3def setup():
 4    py5.no_fill()
 5
 6
 7def draw():
 8    py5.background(204)
 9    t = py5.remap(py5.mouse_x, 0, py5.width, -5, 5)
10    py5.curve_tightness(t)
11    py5.begin_shape()
12    py5.curve_vertex(10, 26)
13    py5.curve_vertex(10, 26)
14    py5.curve_vertex(83, 24)
15    py5.curve_vertex(83, 61)
16    py5.curve_vertex(25, 65)
17    py5.curve_vertex(25, 65)
18    py5.end_shape()

Description#

Modifies the quality of forms created with curve() and curve_vertex(). The parameter tightness determines how the curve fits to the vertex points. The value 0.0 is the default value for tightness (this value defines the curves to be Catmull-Rom splines) and the value 1.0 connects all the points with straight lines. Values within the range -5.0 and 5.0 will deform the curves but will leave them recognizable and as values increase in magnitude, they will continue to deform.

Underlying Processing method: curveTightness

Syntax#

curve_tightness(tightness: float, /) -> None

Parameters#

  • tightness: float - amount of deformation from the original vertices

Updated on November 12, 2021 11:30:58am UTC