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-line.js

v2.0.6

Published

A nest backgroud of website draw on canvas use javascript, do not depends on jQuery.

Downloads

8

Readme

基于 canvas-nest.js 添加了两个参数,一个交汇点宽度,一个线的宽度

一个基于 html5 canvas 绘制的网页背景效果。

npm npm npm gzip

screenshot

安装

# 使用 npm
npm install --save canvas-line.js

# 或者使用 yarn
yarn add canvas-line.js

特性

  • 不依赖 jQuery,使用原生的 javascript。
  • 非常小,只有 2 Kb。
  • 非常容易实现,配置简单,即使你不是 web 开发者,也能简单搞定。
  • 模块化 & 区域渲染。

使用

  • 快捷使用

将下面的代码插入到 <body> 和 </body> 之间.

<script type="text/javascript" src="dist/canvas-nest.js"></script>

强烈建议在 </body>标签上方. 例如下面的代码结构:

<html>
  <head>
    ...
  </head>
  <body>
    ... ...
    <script type="text/javascript" src="dist/canvas-nest.js"></script>
  </body>
</html>

然后就完成了,打开网页即可看到效果!请注意不要将代码置于 <head> </head>里面.

  • 模块化区域绘制(定制开发)

完成安装好,可以使用模块化方式 import。

并且只有一个 API,使用如下:

import CanvasNest from 'canvas-nest.js'

const config = {
  color: '255,0,0',
  count: 88,
  sizeX: 5,
  sizeY: 5,
  lineWidth: 0.5,
}

// 在 element 地方使用 config 渲染效果
const cn = new CanvasNest(element, config)

// destroy
cn.destroy()

配置

  • color: 线条颜色, 默认: '0,0,0' ;三个数字分别为(R,G,B),注意用,分割
  • pointColor: 交点颜色, 默认: '0,0,0' ;三个数字分别为(R,G,B),注意用,分割
  • opacity: 线条透明度(0~1), 默认: 0.5
  • count: 线条的总数量, 默认: 150
  • zIndex: 背景的 z-index 属性,css 属性用于控制所在层的位置, 默认: -1

Example:

  • 快捷使用
<script
  type="text/javascript"
  color="0,0,255"
  opacity="0.7"
  zIndex="-2"
  count="99"
  src="dist/canvas-nest.js"
></script>
  • 模块化区域绘制(定制开发)
{
  color: '0,0,255',
  opacity: 0.7,
  zIndex: -2,
  count: 99,
};

注意: 所有的配置项都有默认值,如果你不知道怎么设置,可以先不设置这些配置项,就使用默认值看看效果也可以的。

相关项目

使用项目

  • A Tool: 一个好用的工具集合.

License

MIT@hustcc.