Giter VIP home page Giter VIP logo

pxlme.js's Introduction

PXLME.js

Javascript 2D Renderer

PXLME (Pixel Me) is an open source framework for dynamic pixel graphics by Tobias Schultka.

Demos

Simple Usage

  // create an app instance
  var app = new PXLME.App();

  // create a stage and push it to the app
  var stage = app.addStage({
    "matrix": [
      "101",
      "010",
      "101"
    ],
    colors : { "1": "#FF0000" }
  });

Advanced Usage

  <div id="pxlme-stage"></div>
  // define an options object
  var opt = {};

  // set the target ID
  opt.containerId = "pxlme-stage";

  // set the width and height of the canvas (px)
  opt.width = 800;
  opt.height = 600;

  // set the pixel matrix. 0 is always no pixel
  opt.matrix = [
    "001111100",
    "012222210",
    "122A2A221",
    "122222221",
    "1222A2221",
    "12A222A21",
    "122AAA221",
    "012222210",
    "001111100"
  ];

  // set the colors of pixels based on the matrix
  opt.colors = {
    "1": "#00BDE3",
    "2": "#f3daca",
    "A": "#d27a8d"
  };

  // set the size of pixels (px)
  opt.pixelSize = 10;

  // set the speed of pixel growing, the farther the pixel is away from start
  opt.pixelSizeRatio = .1;

  // set the maximal pixel size
  opt.pixelSizeMax = 26;

  // set cursor radius
  opt.cursorRadius = 40;

  // set how fast a pixel escapes, if the cursor is nearby
  opt.speedUp = 1.8;

  // set how fast a pixel is going back
  opt.speedDown = .7;

  // set the percentage of speed after every frame (1 = 100%)
  opt.pixelRubbing = .974;
  
  // create an app instance
  var app = new PXLME.App();

  // create a stage and push it to the app
  var stage = app.addStage( opt );

This content is released under the (http://opensource.org/licenses/MIT) MIT License.

pxlme.js's People

Watchers

James Cloos avatar Pavel avatar

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.