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

pixer

v0.1.0

Published

add pixelated canvas gradient between html elements

Downloads

2

Readme

Pixer

Automatically generate pixelated gradient between two block elements. Written in Typescript.

Getting started

Download this plugin from the Github repository or install it through this command:

$ npm install pixer --save

This library is also available through Bower package manager:

$ bower install pixer --save

Required assets

Set some CSS rules for the canvas elements we are going to use. These are some suggested classes:

.js-pixer {
	width: 100%;
	height: 80px;
}

.js-pixer--big {
	width: 100%;
	height: 120px;
}

.js-pixer--small {
	width: 100%;
	height: 40px;
}

Import the Pixer library:

<script src="path/to/dist/pixer.js"></script>

Required markup

Just put a canvas element having the data-pixer attribute in between the two block elements you want to apply the pixelated border to. It's mandatory to set a CSS property for the background of the two target elements:


<!-- target 1 -->
<div style="background:<COLOR>"></div>

<!-- the pixelated gradient border will be generated inside this canvas -->
<canvas data-pixer class="js-pixer"></canvas>

<!-- target 2 -->
<div style="background:<ANOTHER COLOR>"></div>

Start it up

This Javascript library is UMD compliant, so you can consume it even like this:

	var pixer = require('pixer');

	// Call the init function which returns the API object handler
	var pixerApi = pixer();

Or just get the global object bound to the window:

	var pixer = window.pixer;

	// Call the init function which returns the API object handler
	var pixerApi = pixer();

Set some options

At the moment the only customizable setting is the number of stripes that the pixelated border will be formed of. The default amount of stripes is 4.

You can set the custom amount of stripes by passing a valid JSON object into the data-pixer attribute:

<div id="target-1" style="background:<COLOR>"></div>
<canvas data-pixer='{"stripes":"4"}' class="js-pixer"></canvas>
<div id="target-2" style="background:<ANOTHER COLOR>"></div>

API

Available methods:

	var pixerApi = pixer();

	// Reflow all the pixelated borders in the page
	pixerApi.reflow();

AUTHORS

Giancarlo Soverini [email protected]

LICENSE

AGPL-3.0