This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

curveTightness()

Examples
// Move the mouse left and right to see the curve change

void setup() {
  size(100, 100);
  noFill();
}

void draw() {
  background(204);
  float t = map(mouseX, 0, width, -5, 5);
  curveTightness(t);
  beginShape();
  curveVertex(10, 26);
  curveVertex(10, 26);
  curveVertex(83, 24);
  curveVertex(83, 61);
  curveVertex(25, 65); 
  curveVertex(25, 65);
  endShape();
}
Description Modifies the quality of forms created with curve() and curveVertex(). 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.
Syntax
curveTightness(tightness)
Parameters
tightness float: amount of deformation from the original vertices
Returnsvoid
Relatedcurve()
curveVertex()
Updated on January 21, 2019 10:05:11am EST

Creative Commons License