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

mini-gl

v2.0.1

Published

2d webgl renderer like canvas

Downloads

13

Readme

MiniGL

2d WebGL renderer,

  • 纯原生2d渲染库,支持基础图形渲染和鼠标交互操作,使用glMatrix做通用矩阵库。
  • 可以进行自由图形变换,支持原生shader,webGL2.0
  • 可用于高性能2d渲染场景
  • 现已支持龙骨动画^_^

case

扩展

  • 继承MiniGL.Group,并复写setData,render方法和shaders属性来生成一个具有子元素操纵能力的类
  • 继承MiniGL.Base, 并复写shaders,setData,render等方法生成一个mesh类

shader扩展

以下变量会被注入

    uniform mat3 transform; //视图转换矩阵
    uniform mat3 modelView; // 模型转换矩阵
    uniform float pixelRatio;; // 渲染倍数
    uniform float ratio;; // 渲染宽高比

使用如下

    vec3 mPosition = transform * modelView * vec3(position,1.);

由于开启了深度监测,可以通过config.z 来指定层级覆盖关系(默认使用子元素数组顺序渲染)

    vec3 mPosition = transform * modelView * vec3(position,z);

develope

npm i
npm run start

一些想法

由于2d往往更侧重于形状的绘制,而较少有特效比如反光,阴影,波纹等等处理。且一旦有复杂的效果,则需要定制化shader,因此,这里我抛弃了material和geometry的概念,更加注重点,线,面等形状的绘制。如果有复杂的效果推荐自己继承基类进行复写shader和uniform,以得到体验和性能的平衡。