# comet-line

> canvas comet line

Latest version **0.0.5** (published 2021-04-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install comet-line
pnpm add comet-line
yarn add comet-line
bun add comet-line
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2021-04-26 |
| First published | 2021-03-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | chenlong |
| Maintainers | jackchen2018 |

## Links

- npm: https://www.npmjs.com/package/comet-line
- Repository: https://github.com/chenlong-frontend/comet-line
- Homepage: https://github.com/chenlong-frontend/comet-line#readme
- Issues: https://github.com/chenlong-frontend/comet-line/issues
- npm.io page: https://npm.io/package/comet-line

## Dependencies (7)

- [rollup](https://npm.io/package/rollup.md) ^2.42.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.13.10
- [rollup-plugin-babel](https://npm.io/package/rollup-plugin-babel.md) ^4.4.0
- [rollup-plugin-serve](https://npm.io/package/rollup-plugin-serve.md) ^1.1.0
- [rollup-plugin-terser](https://npm.io/package/rollup-plugin-terser.md) ^7.0.2
- [rollup-plugin-node-resolve](https://npm.io/package/rollup-plugin-node-resolve.md) ^5.2.0
- [rollup-plugin-node-polyfills](https://npm.io/package/rollup-plugin-node-polyfills.md) ^0.2.1

## Recent versions

- 0.0.5 (latest) — 2021-04-26
- 0.0.4 — 2021-04-26
- 0.0.3 — 2021-03-23
- 0.0.2 — 2021-03-23
- 0.0.1 — 2021-03-23

## README

<h1 align="center">comet line</h1>

Page micro motion

The effect picture is as follows

![effect picture](./assets/example.png)

## install

```
yarn add comet-line
```

## usage

Import in project

```js
import Comet from 'comet-line'
```

Generate path by inset `square` function, the param is a two-dimensional array, which represents several points on the path.
Point and point will be connected by a straight line, the frist number is `x` offset, second number is `y` offset。

```js
const path = Comet.square([
  [400, 200],
  [600, 400],
  [400, 600],
  [200, 400],
  [400, 200],
])
```

If you want use custom path, like circle path.you must use `Point` function when creat point.The example is as follows

```js
const path = []
path.push(new Comet.Point(100, 200))
```

After set path:

```js
var canvas = document.getElementById('canvas')
var comet = new Comet(canvas, {
  path: path,
  pathVisible: true,
  pathColor: '#444444',
  cometColor: '#66FF00',
})
comet.play()
```

The first param `canvas` need pass `canvas` element

The second config:

| param       | type    | description                                                             |
| ----------- | ------- | ----------------------------------------------------------------------- |
| path        | Point[] | path                                                           |
| pathColor   | string  | the color of path, default `#444444` |
| pathVisible | boolen  | if true, show path.otherwise, hide |
| cometColor  | string  | the color of comet, default `#66FF00`    |

`comet` instance include two functions:

### play

play animation

### stop

stop animation

---
_Source: https://npm.io/package/comet-line · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
