Toxiclibsjs

"Toxiclibs, made by Karsten Schmidt, is probably the most widely used Processing library. It has some really good classes to work with 2D and 3D geometry, physics, colors, audio, and more. In this recipe, we'll take a look at the JavaScript port made by Kyle Phillips. You can find out more about Toxiclibs.js at http://haptic-data.com/toxiclibsjs/ ." VANTOMME, Jan (ed.), 2012. Processing 2: creative programming cookbook: over 90 highly-effective recipes to unleash your creativity with. Birmingham: Packt Publ. Quick answers to common problems. ISBN 978-1-84951-794-2. mastodon

Toxiclibs.js can be used in the following ways:

* As a single javascript file loaded into a webpage, with the contents of the entire library within a global toxi object. * As AMD modules that can be loaded independently or in packages, via RequireJS * In Node.js or Browserify applications, through NPM as commonjs modules.

Use the build github , site

copy the file build/toxiclibs.js:

<script type="text/javascript" src="js/toxiclibs.js"></script> <script type="text/javascript"> var myVector = new toxi.geom.Vec2D(window.innerWidth,window.innerHeight).scaleSelf(0.5); var myColor = toxi.color.TColor.newRGB(128/255,64/255,32/255); </script>

pages/toxiclibsjs

/*! * toxiclibsjs - v0.3.3 * http://haptic-data.com/toxiclibsjs * Created by [Kyle Phillips](http://haptic-data.com), * based on original work by [Karsten Schmidt](http://toxiclibs.org). * Licensed [GPLv2](http://www.gnu.org/licenses/lgpl-2.1.html) */

console.log(myVector); console.log(myColor);

Many of the constructors and other functions have additional support for option objects. For example: site > Differences from the original Toxiclibs

//any object with an `x` and `y` will work var vec = new toxi.geom.Vec2D({ x: 0.5, y: 0.25 }); var map = new toxi.math.ScaleMap({ input: { min: 0, max: 100 }, output: { min: -1, max: 1} }); //var mesh = sphere.toMesh({ // mesh: new toxi.geom.mesh.TriangleMesh('sphere'), // resolution: 20 //});

//wiki.ralfbarkow.ch/assets/pages/toxiclibsjs/esm%2Btoxi.html

See Toxiclibs.js Examples github , MeshDoodle page

MeshDoodle shows how to use the toxi.geom.mesh.TriangleMesh class to dynamically build a 3D mesh, render it using Processing.js