Skip to content

Comment on Instead of a card, make your valentine a website

Comments

This is a fun thing to do. A couple years ago on Valentine's Day I learned a little Canvas to make this for my wife: http://oinksoft.com/valentines-day/

This is very much less romantic:

  function drawHeart(ctx, x, y) {
        x += 100;
        y += 100;

        ctx.beginPath();
        ctx.moveTo(x, y);
        ctx.quadraticCurveTo(x + 30,  y + 60, x + 80,  y + 100);
        ctx.quadraticCurveTo(x + 130, y + 60, x + 160, y);
        ctx.bezierCurveTo   (x + 200, y - 75, x + 100, y - 90, x + 80, y - 20);
        ctx.bezierCurveTo   (x + 60,  y - 90, x - 40,  y - 75, x, y);
        ctx.fill();
        ctx.closePath();
      }
Good job by the way!

That's really sweet. :3

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.