npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rapid-render

v0.1.2

Published

A highly efficient and lightweight WebGL renderer

Downloads

4

Readme

🚀 Rapid.js

A highly efficient and lightweight WebGL renderer

API Docs

stress test demo ( source code )

render demo ( source code )

custom shader demo ( source code )

mask demo ( source code )

Features

  • Fast Rendering: Render 10,000 sprites at 60fps
  • Multi-Texture Support: Batch rendering using GPU's maximum texture units
  • Graphics Drawing
  • Matrix Stack
  • Text Rendering
  • Line Drawing
  • Custom Shaders
  • Texture Clipping
  • Mask

Install

npm i rapid-render

Or use unpkg

<script src="https://unpkg.com/rapid-render/dist/rapid.umd.cjs"></script>

Import

import { Rapid } from "rapid-render"

Useage

let rapid = new Rapid({
    canvas: document.getElementById("game"),
    backgroundColor: Color.fromHex("FFFFFF")
});

// Create texture
const cat = await rapid.textures.textureFromUrl("./cat.png");
//                      R   G   B   A
const color = new Color(255, 255, 255, 255); // Or use Color.fromHex

// Call before rendering
rapid.startRender();

// Render here...

// Call after rendering
rapid.endRender();

// Set canvas size
rapid.resize(100, 100);

Render

const text = rapid.textures.createText({ text: "Hello!", fontSize: 30 })

rapid.save() // Save state
rapid.matrixStack.translate(0,0)
rapid.matrixStack.scale(1)
rapid.matrixStack.rotate(0)

// Render Sprit
rapid.renderSprite(cat, 0, 0, color) // or rapid.renderSprite(cat, 0, 0, { color })

// Rendr Graphic
const path = Vec2.FormArray([[0, 0], [100, 0], [100, 100]])
rapid.renderGraphic(0,0,{points:path, color:green})
// or
// rapid.startGraphicDraw()
// rapid.addGraphicVertex(0, 0, color)
// rapid.endGraphicDraw()

// Render Text
rapid.renderSprite(text, 200, 0)
text.setText("time:" + Math.round(time))

rapid.restore() // back to the previous saved state

Custom Shader

View demo and watch detailed shader code custom shader demo ( source code )

const vertexShaderSource = `...`
const fragmentShaderSource = `...`

const customShader = new GLShader(rapid, vertexShaderSource, fragmentShaderSource)
rapid.startRender()

rapid.renderSprite(plane, 100, 100, {
    shader: customShader, // shader
    uniforms: {
        // Set custom uniform (You can set mat3, vec2, and so on here)
        uCustomUniform: Number(costumUniformValue)
        //  uVec2Uniform: [0,2] // recognized as vec2
        //  uMat3Uniform: [
        //     [0,0,0],
        //     [0,0,0],
        //     [0,0,0],
        //  ]
        // recognized as mat3
    }
});

rapid.endRender()

Screen Shot

screen