MCPcopy Index your code
hub / github.com/clips/pattern / star

Function star

pattern/canvas.js:2010–2026  ·  view source on GitHub ↗
(x, y, points, outer, inner, options)

Source from the content-addressed store, hash-verified

2008}
2009
2010function star(x, y, points, outer, inner, options) {
2011 /* Draws a star with the given points, outer radius and inner radius.
2012 * The current stroke, strokewidth, strokestyle and fill color are applied.
2013 */
2014 if (points === undefined) points = 20;
2015 if (outer === undefined) outer = 100;
2016 if (inner === undefined) inner = 50;
2017 var p = new Path();
2018 p.moveto(x, y+outer);
2019 for (var i=0; i < 2*points+1; i++) {
2020 var r = (i%2 == 0)? outer : inner;
2021 var a = Math.PI * i/points;
2022 p.lineto(x + r*Math.sin(a), y + r*Math.cos(a));
2023 };
2024 p.closepath();
2025 p.draw(options);
2026}
2027
2028/*##################################################################################################*/
2029

Callers

nothing calls this directly

Calls 1

drawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…