Drawing a heart

Is it possible to draw a heart shape using the ellipse command and setting the diameter to a function of x?

1 Like

coding train just did this. subscribe if you haven’t it’s great.

2 Likes

Shameless self-promotion: you can also draw a heart using the curveVertex() function:

1 Like

image I am trying to draw this heart using the coding train video you suggested and substituting the formulas with the ones in the image, but it seems like the frequency of the corner/triangle thingies is too low…

and instead it looks like this Screenshot%20(1)
I’ve tried changing some coefficients in the formula and stuff but nothing seems to work, any ideas on how I could make it look like the original one?

I was just faced with the issue of drawing a heart, and while I realize that there are many solutions, here is mine:

void heart(float x, float y, float s) {
  pushMatrix();
  rotate(radians(45));
  rect(x, y, s, s);
  circle(x, y - s/2, s);
  circle(x - s/2, y, s);
  popMatrix();
}

The result:

2 Likes