-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from acamposuribe/ES6
ES6 Ready
- Loading branch information
Showing
17 changed files
with
646 additions
and
663 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 +1,2 @@ | ||
dist/ | ||
node_modules/ | ||
package-lock.json |
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
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 |
---|---|---|
|
@@ -23,28 +23,43 @@ Embrace the full potential of your creative coding projects with p5.brush.js, wh | |
|
||
## Installation | ||
|
||
Before using p5.brush.js, ensure you include **[Spectral.js](https://github.com/rvanwijnen/spectral.js)**, which is a prerequisite library for color mixing features. | ||
### Local Installation | ||
|
||
### Standard Installation | ||
|
||
To set up your project, add both `p5.brush.js` and `Spectral.js` to your HTML file. Place the script tags in the following order: | ||
To set up your project, add `p5.min.js` `p5.brush.js` to your HTML file. You can download the last version of the p5.brush.js library in the [dist](/dist) folder. | ||
Place the script tags in the following order: | ||
|
||
```html | ||
<!-- Commented version of p5.brush.js, with a Spectral.js dependency --> | ||
<script src="path_to/spectral.min.js"></script> | ||
<script src="path_to/p5.min.js"></script> | ||
<script src="path_to/p5.brush.js"></script> | ||
``` | ||
Replace path_to with the actual path to the minified script in your project directory or the URL if you are using a CDN. | ||
Replace path_to with the actual path to the script in your project directory or the URL if you are using a CDN. | ||
|
||
### Minified Version | ||
### Use a hosted version of the p5.brush.js library | ||
|
||
For improved performance, use the minified version of `p5.brush.js` which bundles `Spectral.js`: | ||
Alternatively, you can link to a `p5.brush.js` file hosted online. All versions are stored in a CDN (Content Delivery Network). You can find a history of these versions in the p5.js CDN. In this case you can change the link to: | ||
|
||
```html | ||
<!-- Minified version of p5.brush.js with Spectral.js included --> | ||
<script src="path_to/p5.brush.min.js"></script> | ||
<!-- Online version of p5.brush --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/p5.brush.js"></script> | ||
``` | ||
|
||
### Install with NPM and other modular-based apps | ||
|
||
Install the npm package. p5.brush requires p5.js as a peer dependency. | ||
|
||
``` | ||
npm install p5.brush --save | ||
``` | ||
Replace path_to with the actual path to the minified script in your project directory or the URL if you are using a CDN. | ||
|
||
After that, import p5.brush functions to your sketch: | ||
|
||
``` | ||
import * as brush from 'p5.brush' | ||
``` | ||
|
||
If you are using p5 and p5.brush as modules, you will need to use instance mode. Read below. | ||
|
||
|
||
### Note for p5 instance mode | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes
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 |
---|---|---|
|
@@ -2,9 +2,8 @@ | |
<html> | ||
<head> | ||
<title>p5.brush.js Example</title> | ||
<script src="./dependencies/p5.min.js"></script> | ||
<script src="./dependencies/spectral.min.js"></script> | ||
<script src="./p5.brush.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/p5.brush.js"></script> | ||
<link rel="stylesheet" href="./style.css"> | ||
</head> | ||
<body> | ||
|
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// rollup.config.js | ||
|
||
import terser from '@rollup/plugin-terser'; | ||
import cleanup from 'rollup-plugin-cleanup'; | ||
|
||
const config = { | ||
input: 'src/index.js', | ||
output: { | ||
file: 'dist/p5.brush.js', | ||
format: 'umd', | ||
name: 'brush', | ||
}, | ||
plugins: [terser(), cleanup({ | ||
comments: "none", | ||
})], | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.