Skip to content

The convenience Math methods from Processing implemented in Javascript

Notifications You must be signed in to change notification settings

trembl/p5.Math.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Javascript implementation of the following Processing convenience methods declared in http://www.google.com/codesearch/p?hl=en#Ej56LtI_pY0/trunk/processing/core/methods/demo/PApplet.java

p5.sq()
p5.constrain()
p5.degrees()
p5.mag()
p5.dist()
p5.lerp()
p5.norm()
p5.map()

Very small in size, probably better to copy the minified version into your project, rather than linking to it.

Added optional extensions to the main Math object:

Math.sq()
Math.constrain()
Math.degrees()
Math.mag()
Math.dist()
Math.lerp()
Math.norm()
Math.map()

This code is not checking whether the methods already exist, use it at your own peril.

Note: Math does not get constructed and instantiated, but rather initialized. Adding methods with Math.prototype.myMethod does not work, rather use Math.myMethod

About

The convenience Math methods from Processing implemented in Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published