Skip to content

Instantly share code, notes, and snippets.

@jcalz
Last active June 25, 2018 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcalz/66d5c8720298c8f0af533cb6e8d23fae to your computer and use it in GitHub Desktop.
Save jcalz/66d5c8720298c8f0af533cb6e8d23fae to your computer and use it in GitHub Desktop.
star clip-path
var format = x => ((x+.5)*100).toFixed(4)+'%';
var f = ([[a,b],[c,d]]) => format(a)+' '+format(b)+', '+format(c)+' '+format(d);
var r = 1.5 - 0.5*Math.sqrt(5);
var th = Math.PI/2;
var pn = 2*Math.PI/5;
var R = .5;
var result=[0,1,2,3,4].map(k =>
[[R*Math.cos(th+pn*(k-.5)),R*Math.sin(th+pn*(k-.5))],[r*R*Math.cos(th+pn*(k+0)),r*R*Math.sin(th+pn*(k+0))]]).map(f).join(', ');
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment