- Author:
- Todd Wolfson
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- twolfson.com
- Compo:
- classic
- Demo link:
- https://js1k.com/2012-love/demo/1170
- Shortlink:
- https://js1k.com/1170
- Blog post:
- please update here!
- Bytes:
- 138
- Chars:
- 138
- Submission
M=Math;o=M.cos;a.strokeStyle='red';i=0;setInterval("a.lineTo(9*M.pow(M.sin(i),3)+10,3*o(2*i)-6*o(i)+2*o(3*i)+o(4*i)+9),a.stroke(),i++",99)
- Description
- Sketches a red heart surrounding an inner white heart
- Base64 encoded
TT1NYXRoO289TS5jb3M7YS5zdHJva2VTdHlsZT0ncmVkJztpPTA7c2V0SW50ZXJ2YWwoImEubGluZVRvKDkqTS5wb3coTS5zaW4oaSksMykrMTAsMypvKDIqaSktNipvKGkpKzIqbygzKmkpK28oNCppKSs5KSxhLnN0cm9rZSgpLGkrKyIsOTkp
- Original source
// It started as this then became so much more
// Attribution to http://mathworld.wolfram.com/HeartCurve.html
M=Math;
cos=M.cos;
function heartX(t) {
return 16 * M.pow(M.sin(t), 3);
}
function heartY(t) {
return 13 * cos(t) - 5 * cos(2*t) - 2 * cos(3*t) - cos(4*t);
}
a.beginPath();
for (i = 0, cap = 1e3, t = 0; i < cap; i++) {
t = i ? M.PI * 2 * i/cap : 0;
a.lineTo(heartX(t) + 50, -heartY(t) + 50);
a.stroke();
}
a.fill();
a.closePath();