2.1.0 • Published 3 years ago

shaped.js v2.1.0

Weekly downloads
57
License
Apache-2.0
Repository
github
Last release
3 years ago

shaped.js

🍭 Generate cool moving shapes using a canvas element

Install

yarn add shaped.js
# or
npm install shaped.js

Usage

You can just copy this example and change the values to your liking.

import { ShapedCanvas } from "shaped.js"

new ShapedCanvas(document.querySelector("#canvas"), {
    // This determines how many lines will be generated.
    // Just play with the value until you're happy with it.
    probability: 1 / 40000,
    minCount: 8,
    colors: [
      "rgba(0, 0, 0, 0.7)",
      "rgba(0, 255, 150, 0.8)",
      "rgba(0, 150, 255, 0.7)"
    ],
    // Use a single value
    height: 50,
    length: 50,
    // Or a range
    speed: [0.2, 0.8],
    // Every line gets a new Y coordinate as soon as it leaves the screen
    randomizeYAfterLeave: true,
    // The width and height of the canvas will be synced with the width and height of the window.
    useWindowSize: true
});
2.1.0

3 years ago

2.0.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago