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

stormerjs

v1.0.1

Published

Declarative 2D Graphics on HTML5 Canvas

Downloads

3

Readme

Stormer - Declarative 2D Graphics on HTML5 Canvas

About Stormer

Stormer (named after Loki Stormbringer, a character in Dan Suarez's Daemon series) is a JavaScript library that wraps over the HTML5 Canvas API. It enables declarative drawing by recording "intents" and replaying them later. Stormer currently supports 2D drawing and animation.

Quick start

You can install Stormer using the package manager of your choice.

Using npm

  • $ npm i stormerjs

Using yarn

  • $ yarn add stormerjs

Usage

Here is how Stormer code looks like,

import Stormer from 'stormerjs';

const root = Stormer.createRoot('mycanvas');
const layerOne = Stormer.createLayer();
const layerTwo = Stormer.createLayer();

const rectOne = Stormer.createRectangle(
    0, 60,
    100, 100
    ).attachTo(layerOne);

rectOne.props
  .fillStyle('violet')
  .shouldFill(true);

const rectTwo = Stormer.createRectangle(
    120, 60,
    100, 100
    ).attachTo(layerTwo);

rectTwo.props()
  .fillStyle('orange')
  .shouldFill(true);

root.render();

And that's it! When you call root.render(), Stormer will handle the rest and deliver two styled rectangles to your canvas.

Features

While the above example code might seem like a lot just to draw two rectangles, Stormer gives one the ability to concetrate on what they are creating rather than on how they are creating it. The author of Stormer believes tools should never get in the way of creativity.

Here are some features of Stormer that you might like:

  1. Elements - Stormer comes built in with primitives for drawing shapes, text and images. A Stormer element behaves as if it is the only element on the canvas. This means one can apply properties and transforms without affecting other elements.

  2. Layers - A Stormer abstraction that allows grouping of elements. One thing you can do with a layer is animate it, or apply properties to all elements in a layer. Stormer guarantees changes applied to one layer will not affect other layers.

  3. Declarative API - Due to it's declarative nature, Stormer code is easy to reason with and understand. One can follow through the code and see what they did. Stormer code is easy to debug.

  4. Easy to Learn - The structure of Stormer code should be familiar to any JavaScript developer. Stormer's API relies heavily on method chaining, jQuery style.

Using with UI Libaries

Stormer should work (tested on React) with any UI library/framework. Consult the miscellaneous section of the docs for further information.

Documentation

For those who want a hands-on approach, I encourage you to browse the examples directory.

For full Stormer documentation and API reference, click here

The author of Stormer barely comments his code, though he strives for clean and simple code. One could learn all about Stormer by browsing the src directory. The source code is self-documenting.

Bugs & Issues

Stormer is not behaving as you expected? It could be a bug, open an issue.

You have an idea for a feature or any extension to Stormer? Open an issue or go ahead and PR.

Contributing

Stormer is a work in progress, just as all software is. Pull requests are encouraged for the following:

License

Stormer is MIT-licensed free and open source software. You can read the license here