Git Product home page Git Product logo

hexagon.js's Introduction

Hexagon.js

A JavaScript library for drawing and interacting with hex grids. Demo and usage

Currently Hexagon.js only supports flat topped hexagons (pull requests welcome).

Simply use the following html:

<!DOCTYPE html>
<head>
    <title>Hex</title>
    <script src="hexagon.js"></script>
</head>
<body>
    <canvas id="HexCanvas" width="1000" height="700"></canvas>
    <script>
        var hexagonGrid = new HexagonGrid("HexCanvas", 50);
        hexagonGrid.drawHexGrid(7, 10, 50, 50, true);
    </script>    
</body>

Call the HexagonGrid constructor with the id of your canvas and the radius of your hexagons. drawHexGrid takes the number of columns and rows followed by an offset. Optionally the coordinate system can be displayed.

A hexagon can be drawn at an abitrary point with drawHex(). Additionally there is the helper function drawHexAtColRow() which draws a hexagon at a grid column/row coordinate.

hexagon.js's People

Contributors

rrreese avatar

Stargazers

Quentin Dutot avatar James Blash avatar Meow avatar Mikko Saario avatar  avatar  avatar  avatar Michael Power avatar Ben Stern avatar  avatar  avatar Skip Levens avatar E. Newman avatar Ruben del Blanco Rey avatar  avatar Pavel Kuznetsov avatar  avatar  avatar Simon Kirkby avatar Kelly Youngblood avatar Lauren Herda avatar Dainius Pužas avatar  avatar Itay Donanhirsh avatar redmed avatar Erdong avatar Didymus avatar  avatar Wany Bae avatar gvzr avatar Gábor Angyal avatar  avatar Vlad Liamzin avatar Matthew Cliatt avatar Piotr Matuszewski avatar Alex Nisnevich avatar 鹅叔 avatar Jörg Steffens avatar Marcelo Lira avatar Mark Luetke avatar Benny Neugebauer avatar Maxwell Nesler avatar Sean avatar Zachary Prisk avatar Henry avatar Anthony Bishopric avatar  avatar Lucía Gil Román avatar Jon Mayo avatar Nate Geslin avatar Ryoji Miyazato avatar Robin Larsson avatar Arwennnnn avatar  avatar Mike Tobia avatar  avatar Andrew Belt avatar Michael Anthony avatar  avatar Eriks Vitolins avatar Yvan Sraka avatar  avatar  avatar Jean-Christophe Nicolas avatar Alexander Elgin avatar codeGlaze avatar Li Song avatar Moheeb Zara avatar  avatar Chris Hinkley avatar Thomas Lombardi avatar Michael Huntington avatar David Bonet avatar Gökay Gürcan avatar Anton Yakushev avatar Jan Geselle avatar Lauren Boland avatar Mr zhan avatar

Watchers

 avatar lingfan avatar Alexander Elgin avatar James Cloos avatar Michael Anthony avatar David Bonet avatar codeGlaze avatar Sean avatar Joe Faulstick avatar

hexagon.js's Issues

drawHexAtColRow deprecated?

Looking through hexagon.js it seems that the method "drawHexAtColRow" (line 50) is either redundant or deprecated.

Commenting it out changes nothing that I can tell. Is there a reason for it being in there?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.