Site icon DIY Usthad

How to draw Heart ♥️ using processing

drawing Heart using processing

Introduction

Today we are going to draw a heart shape ♥️ using Processing.

Polar equation of Heart

x = 
y = 

for more heart equation check out this site  http://mathworld.wolfram.com/HeartCurve.html

Hope you guys like it, try to draw a beating heart  ♥️

Code


int HeartSize=5;
void setup()
{
  size(700,700,P2D);
  frameRate(60);
  background(0);
}

void draw()
  {
    translate(350,350);
    stroke(250, 0, 0);
    strokeWeight(2); 
    for (float t=0; t<=2*PI; t+=.01)
      point((-16*HeartSize*pow(sin(t), 3)), (-(13*HeartSize*cos(t)-5*HeartSize*cos(2*t)-2*HeartSize*cos(3*t)-cos(4*t))));
  }

Exit mobile version