SkillAgentSearch skills...

P5.Math.js

The convenience Math methods from Processing implemented in Javascript

Install / Use

/learn @trembl/P5.Math.js
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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()<br /> p5.constrain()<br /> p5.degrees()<br /> p5.mag()<br /> p5.dist()<br /> p5.lerp()<br /> p5.norm()<br /> p5.map()<br />

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()<br /> Math.constrain()<br /> Math.degrees()<br /> Math.mag()<br /> Math.dist()<br /> Math.lerp()<br /> Math.norm()<br /> Math.map()<br />

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

Related Skills

View on GitHub
GitHub Stars25
CategoryDevelopment
Updated6mo ago
Forks5

Languages

JavaScript

Security Score

72/100

Audited on Oct 5, 2025

No findings