A Texture Generator with JavaScript and Canvas – texgen.js

Category: Javascript , Recommended | February 28, 2016
Author: mrdoob
Views Total: 2,556
Official Page: Go to website
Last Update: February 28, 2016
License: MIT

Preview:

A Texture Generator with JavaScript and Canvas – texgen.js

Description:

texgen.js is a pure JavaScript library used to draw static or animated textures using Html5 canvas 2D drawing API.

Basic usage:

Load the texgen.js in the document.

<script src="src/TexGen.js"></script>

The sample JavaScript.

var texture = new TG.Texture( 256, 256 )
    .add( new TG.XOR() )
    .mul( new TG.OR().color( 0.5, 0.8, 0.5 ) )
    .mul( new TG.SinX().frequency( 0.0312 ) )
    .div( new TG.SinY().frequency( 0.0312 ) )
    .add( new TG.SinX().frequency( 0.004 ).color( 0.5, 0, 0 ) )
    .add( new TG.Noise().color( 0.1, 0.1, 0.2 ) )
    .toCanvas();

document.body.appendChild( texture );

Changelog:

02/28/2016

  • Bugfix

You Might Be Interested In:


Leave a Reply