Giter Site home page Giter Site logo

jojoee / pixel-mask-generator Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 0.0 146 KB

:video_game: :game_die: Procedural pixel generator (mask) + visualizer

Home Page: https://jojoee.github.io/pixel-mask-generator

License: MIT License

CSS 8.48% JavaScript 83.07% HTML 8.45%
pcg pcgen pixel mask generator pixel-sprite-generator visualization

pixel-mask-generator's Introduction

pixel-mask-generator

Travis Codecov Version - npm License - npm semantic-release

Very inspired and copy some code from zfedoran/pixel-sprite-generator

pixel-mask-generator - screenshot Greenkeeper badge

Installation

// npm
npm install pixel-mask-generator --save
const pmg = require('pixel-mask-generator')

// Bower
bower install pixel-mask-generator --save
<script src="bower_components/pixel-mask-generator/dist/index.js"></script>

Example usage

const mask = new pmg.Mask([
  0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 1, 1,
  0, 0, 0, 0, 1, -1,
  0, 0, 0, 1, 1, -1,
  0, 0, 0, 1, 1, -1,
  0, 0, 1, 1, 1, -1,
  0, 1, 1, 1, 2, 2,
  0, 1, 1, 1, 2, 2,
  0, 1, 1, 1, 2, 2,
  0, 1, 1, 1, 1, -1,
  0, 0, 0, 1, 1, 1,
  0, 0, 0, 0, 0, 0
], 6, true, false)
const sprite = new pmg.Sprite(mask)
sprite.generate()

// resize and append
const resizedSpriteCanvasEle = pmg.util.resize(sprite.canvas, 10)
const body = document.body
body.appendChild(resizedSpriteCanvasEle)

Note

  • Compatible with all browsers
  • Unit test: add more tests
  • Automated scripts: browser compatibility test
  • Automated scripts: deploy to gh-pages
  • Branch: split code from master and gh-pages
  • Dependency: split static/random.js to another repository
  • Dependency: split resize function to another repository
  • Mask: add more masks
  • Demo: update demo page
  • Coverage: increase coverage threshold
  • Article: copy original article into the repo, in case the site and mirror are down
  • Algorithm: change algorithm toward to the original, should be symmetrical

Contribute for owner

$ npm install -g semantic-release-cli
$ semantic-release-cli setup

Using above command to setup "semantic-release"

Contribute

  1. Fork the repo
  2. Install Node.js and dependencies
  3. Make a branch for your change and make your changes
  4. Run git add -A to add your changes
  5. Run npm run commit (don't use git commit)
  6. Push your changes with git push then create Pull Request

Reference

pixel-mask-generator's People

Contributors

greenkeeper[bot] avatar jojoee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.