P5.Math.js
The convenience Math methods from Processing implemented in Javascript
Install / Use
/learn @trembl/P5.Math.jsREADME
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
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
