This time I will share jQuery Plugin and tutorial about Random Pixel Avatar/Image Generator With jQuery and Canvas – gixi, hope it will help you in programming stack.
gixi is a small JavaScript library for jQuery that utilizes Canvas 2D API to draw random pixel images / avatars as you seen on Github.com. It also can be implemented as a standalone JavaScript plugin without any dependencies.
How to use it:
1. First you need to include the jQuery gixi plugin after jQuery JavaScript library like this:
1 |
< script src = "//code.jquery.com/jquery-2.2.1.min.js" ></ script > |
2 |
< script src = "dist/gixi-min.js" ></ script > |
2. Create an empty container for the pixel image / avatar.
1 |
< div class = "gixi" ></ div > |
3. Just call the function on the container element and you’re done.
4. Implement as a JavaScript plugin.
2 |
< img id = "gixie" alt = "gixie" width = "300" height = "300" /> |
1 |
var element = document.getElementById( 'gixie' ); |
2 |
var imageData = new GIXI(300).getImage(); |
4 |
element.setAttribute( 'src' , imageData); |
Change log:
2016-03-13
This awesome jQuery plugin is developed by linuxenko. For more Advanced Usages, please check the demo page or visit the official website.