Skip to content

Curve Control PointerEvent

Image Name

Curve Control Points

Run the Curve Control Point MicroSim Edit Curve Control Points MicroSim

Curve Percent

Curve Percent Edit Curve Percent

Custom Curve with Percent Function

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// Draw a curve with only the percent drawin
function customCurve(c1x, c1y, x1, y1, x2, y2, c2x, c2y, percent) {
  beginShape();
  for (let t = -0.01; t <= percent + 0.01; t += 0.01) {
    let v0 = createVector(c1x, c1y);
    let v1 = createVector(x1, y1);
    let v2 = createVector(x2, y2);
    let v3 = createVector(c2x, c2y);
    let x = curvePoint(v0.x, v1.x, v2.x, v3.x, t);
    let y = curvePoint(v0.y, v1.y, v2.y, v3.y, t);
    curveVertex(x, y);
  }
  endShape();
}