gamem-wasm
v1.0.1
Published
WebAssembly port of Gamem math, geometry, and physics library
Maintainers
Readme
Gamem WASM
🎮 Gamem WASM is a TypeScript/JavaScript library of Physics, Math and Geometry helpers, powered by WebAssembly. It was created for you to type code in one line instead of huge formulas. It works everywhere in the web! From vanilla JS to Phaser, PixiJS and Three.js! 👾
🌟 Features
- MathGm:
randomRange,smoothStep,lerp,inverseLerp,smoothDamp,smoothDampAngleand more. - PhysicsGm:
applyGravity,applyFriction,addForce,addImpulse,clampVelocity,bounceand more. - GeometryGm:
reflect,reflect3D,getCrossProduct,toRadians,toDegrees,getDistance,checkCircleVsCircleand more.
🛍️ Installation
Type this command in your project terminal:
npm install gamem-wasm⚙️ How to use
To use Gamem methods just import them:
import { MathGm, GeometryGm, PhysicsGm } from 'gamem-wasm';🚀 Get Started
You must initialize the library before using any methods
import { MathGm, GeometryGm, PhysicsGm, initializeGamem } from "gamem-wasm";
import gamemWasmFactory from "gamem-wasm/dist/gamem_wasm.js";
async function main() {
await initializeGamem(gamemWasmFactory); // Very important!
// Now you can use any method!
// example:
const num: number = MathGm.lerp(1, 2, 0.5);
console.log(num); // 1.5
}
main(); // Call main to run the code✨ Why Gamem?
- 🍃 Zero Dependencies - Pure TypeScript wrapper around compiled C++ code
- 🎮 Engine doesn't matter - You can use it in any web engine or vanilla project!
- ⚡ Good performance - Optimized methods by using WebAssembly
❤️ Contributing
- ⭐ Liked the project? Leave a star for this repo, it motivates me to develop this project!
- 🗨️ Have any ideas or found a bug? Open an issue or send Pull Request!
⚖️ License
Gamem WASM is licensed under the MIT license
