GithubHelp home page GithubHelp logo

metanoiex / ingress-glyph-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gm9/ingress-glyph-tools

0.0 1.0 0.0 552 KB

a JavaScript Library and Tools for Ingress Glyph.

Home Page: http://gm9.github.io/ingress-glyph-tools/

License: MIT License

CSS 0.27% HTML 31.00% JavaScript 68.74%

ingress-glyph-tools's Introduction

Ingress Glyph Tools

a JavaScript Library and Tools for Ingress Glyph.

Examples: http://gm9.github.io/ingress-glyph-tools

License

This software is released under the MIT license, see LICENSE.txt.

Usage

Input Pad

<!DOCTYPE html>
<html>
  <head>
    <script type="text/javascript" src="glyph-tools.js" charset="utf-8"></script>
  </head>
  <body>
    <h1>Input Pad</h1>
    <div id="input"></div>

    <script>
      var gm9igt = gm9.IngressGlyphTools;

      // Create Input Pad
      var options = {
        size: 200 //(default 300px)
      };
      var pad = gm9igt.createInputPad(options);
      document.getElementById("input").appendChild(pad);

      // Show Input Result(Glyph Code)
      pad.addEventListener("glyphstrokeend", onGlyphStrokeEnd, false);
      function onGlyphStrokeEnd(){
        var glyph = pad.getGlyph();
        alert(glyph.toString());
        pad.clearGlyph();
      }
    </script>
  </body>
</html>

Glyph Dictionary

Require glyph-dic.js

<script type="text/javascript" src="glyph-dic.js" charset="utf-8"></script>

Glyph to glyph names:

var gm9igt = gm9.IngressGlyphTools;
var simpleGlyph = gm9igt.Glyph.fromString("78"); // node #7 to #8
var words = gm9igt.glyphDic.getWordsFromGlyph(simpleGlyph);
alert(words[0]); //=Simple

Glyph name to glyphs:

var gm9igt = gm9.IngressGlyphTools;
var glyphs = gm9igt.glyphDic.getGlyphsFromWord("simple");
alert(glyphs[0].toString()); //=78

Enumerate all glyphs:

var gm9igt = gm9.IngressGlyphTools;
var glyphs = gm9igt.glyphDic.getAllGlyphs();

Create a Glyph Image

var gm9igt = gm9.IngressGlyphTools;
var glyph = gm9igt.glyphDic.getGlyphsFromWord("idea")[0];
var GLYPH_SIZE = 100;
var GLYPH_STYLE = {
  //see: function completeGlyphStyle() in glyph-tools.js
};

// as HTML5 Canvas
var canvas = gm9igt.createGlyphImage(glyph, GLYPH_SIZE, GLYPH_STYLE);
document.body.appendChild(canvas);

// as SVG
var svg = gm9igt.createGlyphSVG(glyph, GLYPH_SIZE, GLYPH_STYLE);
document.body.appendChild(svg);

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.