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 🙏

© 2025 – Pkg Stats / Ryan Hefner

two-easy-engine

v0.2.1

Published

A simple 2D library.

Readme

⚠️ Experimental API: TwoEasyEngine is a very new project. The API is still evolving and may change in the future, especially as support for other rendering contexts is added. Take a look at the TwoEasyEngine roadmap for more information.

CI pages-build-deployment npm version License: MIT


TwoEasyEngine is a lightweight 2D library built on HTML5 Canvas, offering a simple, object-oriented API for scenes, meshes, cameras, and animations.

Features

  • Meshes with geometry and materials: Easily create shapes like Rectangles and Circles.
  • Texture2D support: Use images in materials to display patterns beyond solid colors.
  • Vector transformations: Manipulate position, rotation, and scale with ease.
  • Camera2D support: Control position, rotation, and zoom for dynamic scenes.
  • Scene management: Organize and render multiple 2D objects efficiently.
  • Offscreen canvas support: Use the library with an offscreen canvas in a Worker thread.
  • Simple animation loop: Built-in requestAnimationFrame wrapper for easy management.
  • TypeScript ready: Modern JavaScript with type declarations for IDE autocompletion.

Installation

Install TwoEasyEngine via npm:

npm install two-easy-engine

Or using Yarn:

yarn add two-easy-engine

Quick Start

Create an HTML file with the following content to create a basic scene:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style>
      body,
      html {
        margin: 0;
        padding: 0;
        overflow: hidden;
        width: 100%;
        height: 100%;
      }
      #canvas {
        width: 100%;
        height: 100vh;
      }
    </style>
  </head>
  <body>
    <canvas id="canvas"></canvas>
    <script type="module">
      import * as Two from "two-easy-engine";

      // Get the canvas element
      const canvas = document.getElementById("canvas");

      // Create a clock, camera, scene, and renderer
      const clock = new Two.Clock();
      const camera = new Two.Camera2D();
      const scene = new Two.Scene();
      const renderer = new Two.Renderer2D(canvas, scene, camera, {
        width: window.innerWidth,
        height: window.innerHeight,
        devicePixelRatio: window.devicePixelRatio || 1,
        backgroundColor: "black",
      });

      // Create a rectangle mesh
      const mesh = new Two.Mesh(
        new Two.RectGeometry(50, 50),
        new Two.BasicMaterial({
          fillStyle: new Two.RgbaColor(0, 255, 0, 1),
          strokeStyle: new Two.RgbaColor(0, 200, 0, 1),
          lineWidth: 2,
        })
      );
      mesh.transform.position.set(renderer.centerX, renderer.centerY);
      scene.add(mesh);

      // Handle window resize to ensure responsiveness rendering
      window.onresize = () => {
        // Resize the canvas
        renderer.options.setSize(window.innerWidth, window.innerHeight);
        // Set the new center position
        mesh.transform.position.set(renderer.centerX, renderer.centerY);
      };

      const speed = 1.5;

      // Animation loop
      renderer.requestAnimationFrame({
        beforeRender: () => {
          clock.update();

          const delta = clock.deltaTime;

          mesh.transform.rotation += delta * speed; // Rotate the rectangle
        },
      });
    </script>
  </body>
</html>

Development

Install dependencies

npm install

Build static files

npm run build

Run all test

npm test

Deploy to NPM

npm run build
npm publish

Docs

npm run docs:gen # generate docs
npm run docs:dev # dev view
npm run docs:build # build static files
npm run docs:preview # prod. preview
npm run docs:deploy # deploy docs

Contributing

Contributions are welcome! Get started by reading our Contributing Guidelines.

License MIT License

See LICENSE for more information.