-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:scottbedard/gradient
- Loading branch information
Showing
1 changed file
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
# Gradient | ||
# `@bedard/gradient` | ||
|
||
Docs coming soon... Or never. | ||
A customizable version of the background animation used by Stripe.com | ||
|
||
[Click here for a live example](https://gradient.scottbedard.net) | ||
|
||
### Basic usage | ||
|
||
Install the script using the CDN | ||
|
||
```html | ||
<script src="https://unpkg.com/@bedard/gradient"></script> | ||
``` | ||
|
||
Or via NPM | ||
|
||
```bash | ||
npm install @bedard/gradient | ||
``` | ||
|
||
Then instantiate an instance with reference to a canvas | ||
|
||
```js | ||
const canvas = document.querySelector('canvas') | ||
|
||
new Gradient(canvas, { | ||
colors: ['#ffffff', '#f87171', '#f9a8d4', '#fef08a'], | ||
seed: Math.random(), | ||
}) | ||
``` | ||
|
||
The animation can be started / stopped using the `play` and `pause` methods. |