Skip to content

G0tzya/Trite

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ Trite ⚡

Trite is a lightweight, high-performance 2D graphics library for the web. While it uses the familiar HTML5 Canvas API for setup, all rendering is powered by WebGL2 for maximum speed through batched draw calls.

✨ Features

  • 🚀 WebGL2 Powered: Hardware-accelerated rendering for smooth performance.
  • 📦 Batched Rendering: Automatically group similar shapes into single draw calls.
  • 🎨 Simple Primitives: Easily draw Circles, Triangles, Rectangles, and Lines.
  • 🔄 Reusable Arrays: Optimized memory management for dynamic scenes.
  • Modern Syntax: Full JSDoc support for excellent IDE autocomplete.

📦 Installation

Install via npm:

npm install @gotzya/trite

🚀 Quick Start

import { Render, Rectangle } from "@gotzya/trite";

const canvas = document.getElementById("canvas");
const render = new Render(canvas);

// Clear the screen
render.setClearColor(23, 23, 23);
render.clear();

// Draw a simple rectangle
const rect = new Rectangle(50, 50, 100, 100);
rect.setColor(27, 208, 178);
rect.draw();

// Batched rendering (High Performance)
const batch = new Rectangle();
batch.add(200, 50, 50, 50, 237, 134, 55);
batch.add(300, 50, 50, 50, 237, 134, 55);
batch.draw();

📖 Documentation

For a full list of classes, methods, and parameters, check out the: 📚 [Detailed API Reference]

🛠️ Development & Tests

To run the local tests, host the project on a local server (e.g., VS Code Live Server) to bypass browser CORS restrictions.

📜 License

This project is licensed under the MIT License.

About

A simple and easy to use WebGL 2D graphics library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%