Mraph.js
✏️ Mraph.js is my poor rendering engine for graphing mathematical objects in a browser.
Install / Use
/learn @SeiyaCooper/Mraph.jsREADME
Mraph.js is my poor animation engine for drawing geometric shapes in a browser, inspired by manim
Github |
NPM |
Examples
Usage
Install with npm:
npm install --save mraph
or use yarn:
yarn add mraph
A short example:
Once you installed, try this example below.
import * as MRAPH from "mraph";
// Creates a new layer
const layer = new MRAPH.Layer().appendTo(document.body);
// Creates some points and sets their position
const pointsNum = 50;
const layersNum = 5;
const angleUnit = (Math.PI * 2) / pointsNum;
for (let j = 0; j < layersNum; j++) {
for (let i = 1; i <= pointsNum; i++) {
const point = new MRAPH.Point(Math.cos(angleUnit * i) * (3 + j * 2), Math.sin(angleUnit * i) * (3 + j * 2));
point.setColor(new MRAPH.Color(Math.random(), Math.random(), Math.random()));
layer.add(point);
}
}
// Sets an infinite event
// This event will remain perpetually active
layer.timeline.addInfinite(() => {
layer.scene.children.forEach((point, i, arr) => {
point.a = point.center.mult((-1 * i) / arr.length);
});
});
// Starts playing animation
layer.enableOrbitControl().enableRotate = false;
layer.play();
Input this code in your preferred text editor. If all proceeds as it should, you will observe a series of dots engaged in a, hmm..., rather peculiar dance.
Contribution
Feel free to contribute to this repo
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate 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
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
