Created
December 2, 2012 20:02
-
-
Save nicksheffield/4190758 to your computer and use it in GitHub Desktop.
Raphael.js - Variable Width Hexagon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hexagon(x,y,w,h){ | |
return paper.path( | |
'M' + (x+12) + ',' + y | |
+ 'L' + (x+12+w) + ',' + y | |
+ 'L' + (x+24+w) + ',' + (y+(h/2)) | |
+ 'L' + (x+12+w) + ',' + (y+h) | |
+ 'L' + (x+12) + ',' + (y+h) | |
+ 'L' + x + ',' + (y+(h/2)) | |
+ 'L' + (x+12) + ',' + y | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another version: