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

canvas-nest-class.js

v1.0.1

Published

一个基于html5 canvas绘制的网页背景效果,非常赞!

Downloads

4

Readme

canvas-nest.js 是一款好看的粒子背景插件,效果比较酷,很早之前就在某网站上发现了,去 GitHub 翻找一下就找到了这个:

GitHub 链接: https://github.com/hustcc/canvas-nest.js

因为不是模块化的,所以我就造了个轮子。。。

特性

  • 不依赖任何框架或者内库,比如不依赖 jQuery,使用原生的 javascript。
  • 非常小,只有1.6 kb,如果开启 gzip,可以更小。
  • 非常容易实现,配置简单,即使你不是web开发者,也能简单搞定。

浏览器

使用非常简单,将下面的代码插入到 <body></body> 之间就行了。

<html>
<head>
  ...
</head>
<body>
  ...
  ...
  ...
  <script type="text/javascript" src="../dist/canvas-nest-class.js"></script>
  <script type="text/javascript">
    new CanvasNest();
  </script>
</body>
</html>

这样子它会自动在 <body> 中创建一个 <canvas> 并进行一些样式调整。

NPM安装

npm install canvas-nest-class.js -S

CommonJS

var CanvasNest require('canvas-nest-class.js')

ES6

import CanvasNest from 'canvas-nest-class.js'

AMD

define(['canvas-nest-class.js'], function(CanvasNest) {
  // body
});

配置与使用

new CanvasNest({
  el: document.querySelector('canvas'), // 默认自动添加 <canvas> 到 <body>
  opacity: 0.1, // 最低透明度,默认 0.1
  color: '0,0,0', // 线条颜色,默认 "0,0,0"
  count: 99, // 生成点的数量,默认 99
  zIndex: -1 // 自动添加的 <canvas> z-index样式属性,默认 -1
});