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

malyan

v0.0.7

Published

JavaScript canvas 2D engine library

Downloads

18

Readme

Malyan

NPM package NPM downloads Build Status Coverage Status MIT License

JavaScript Canvas 2D library

Malyan is a lightweight canvas 2D library that makes it easy to work with HTML5 canvas element.

Benefit from interactive object model,Malyan allows you to easily create simple geometrical shapes like rectangles, circles and other polygons or more complex shapes made up of many paths in <canvas> HTML element. It also allows you to manipulate the size, position and rotation of these objects. It’s also possible to change some of the attributes of these objects such as their color, opacity, etc.

Malyan also provides an extensive event system, starting from low-level "mouse" events (click, mousedrag, mouseEnter, etc) to high-level objects ones (object:mousemove, object:mousedrag).

HomeExamplesDocumentation中文文档Help

Usage

  // Direct Download
  <script src="js/malyan.min.js"></script>
  • Unpkg.com provides NPM-based CDN links. The above link will always point to the latest release on NPM.
  // CDN
  <script src="https://unpkg.com/malyan"></script>
  // or use a specific version/tag via URLs
  <script src="https://unpkg.com/[email protected]/dist/malyan.min.js"></script>
  • Install with NPM
  npm install malyan --save

Example

Here is a HTML boilerplate for rendering a rectangle in malyan:

<!DOCTYPE html>
<html>

<body>
    <canvas id="canvas"></canvas>
    <script src="https://unpkg.com/malyan"></script>
    <script>
        var canvas = new Malyan({
            id: 'canvas',
            width: 500,
            height: 500,
        })

        var rect = new Malyan.Rect({
            name: 'rect',
            x: 0,
            y: 0,
            width: 60,
            height: 80,
            fillStyle: 'rgba(64, 196, 255, 0.2)',
            strokeStyle: '#40c4ff',
            lineWidth: 2,
        })
        rect.translation = {
            x: 100,
            y: 100
        }
        rect.on('mousedrag', function(e) {
            rect.translation = {
                x: rect.translation.x + e.detail.deltaPoint.canvas.x,
                y: rect.translation.y + e.detail.deltaPoint.canvas.y
            }
        })
        canvas.add(rect)

        function animateLoop() {
            canvas.render()
            requestAnimationFrame(animateLoop)
        }
        animateLoop()
    </script>
</body>

</html>

Complex Examples

more examples

Development

  • Dev build

You will have to clone directly from GitHub and build malyan yourself if you want to use the latest dev build.

git clone https://github.com/HarryChen0506/malyan.git
cd malyan
npm install
npm run build
  • Update docs
npm run docs

Change log

Change Log

License

MIT