MCPcopy Create free account
hub / github.com/ActiveState/code / $

Function $

recipes/JavaScript/578626_Canvas_static_forms/recipe-578626.js:39–55  ·  view source on GitHub ↗
(cX, cY, vol)

Source from the content-addressed store, hash-verified

37 $(Math.floor(cnv.width / 2), Math.floor(cnv.height / 2), 7);
38
39 function $(cX, cY, vol) {
40 var x = 0, y = 0, f;
41 ctx.beginPath();
42
43 for (var cr = 0; cr <= 360; cr += 0.01) {
44 f = vol * (4 + Math.sin(5 * cr) +
45 0.5 * Math.sin(10 * cr) +
46 1 / 6 * Math.sin(60 * cr)
47 ) * (cr / 50 + 1);
48 x = Math.floor(f * Math.cos(cr) + cX);
49 y = Math.floor(f * Math.sin(cr) + cY);
50
51 if (cr == 0) ctx.moveTo(x, y);
52 ctx.lineTo(x, y);
53 }
54 ctx.stroke();
55 }
56 </script>
57 </body>
58</html>

Callers 1

recipe-578626.jsFile · 0.85

Calls 3

sinMethod · 0.80
cosMethod · 0.80
moveToMethod · 0.45

Tested by

no test coverage detected