Skip to content

Commit

Permalink
updated with new version of postpre
Browse files Browse the repository at this point in the history
  • Loading branch information
bandaloo committed Nov 16, 2020
1 parent 63acfc0 commit 3e90fa1
Show file tree
Hide file tree
Showing 5 changed files with 282 additions and 182 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ the `p5` script and before your sketch script:

## Building

(This build process will be replaced with an easier one soon. postpre will be
a submodule so the build process isn't divided between two different repos.)

This repo includes `p5bundle.js` produced by the `npm run p5` script in the
postpre package. Running `sh build.sh` literally justs concatenates
`p5bundle.js` with `p5extensions.js` (which does the extending of the p5
prototype) to produce `post5.js`. This file is committed for convenience.
also, `p5.js` version 1.1.9 is also included so that the examples work out
the gate. The included examples use `post5.js` so run `sh build.sh` after
making changes to `p5extensions.js`.
postpre package available [here](https://github.com/bandaloo/postpre).
Running `sh build.sh` literally justs concatenates `p5bundle.js` with
`p5extensions.js` (which does the extending of the p5 prototype) to produce
`post5.js`. This file is committed for convenience. also, `p5.js` version
1.1.9 is also included so that the examples work out the gate. The included
examples use `post5.js` so run `sh build.sh` after making changes to
`p5extensions.js`.
12 changes: 12 additions & 0 deletions examples/colordistexample.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<script src="../p5.js"></script>
<script src="../post5.js"></script>
<script src="colordistsketch.js"></script>
</head>
<body>
<h1>types of blur</h1>
<h2>move the mouse to move the circle around</h2>
</body>
</html>
30 changes: 30 additions & 0 deletions examples/colordistsketch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @ts-nocheck
let white = false;

function setup() {
createCanvas(400, 400);
background(255);
addEffects(
godrays({ samplerNum: -1, lightPos: nMouse(), density: 0.5 }),
channel(
-1,
op(pos(), "+", op(get2Comp(fColor(), "rg"), "*", op(nMouse(), "-", 0.5)))
)
);
}

function draw() {
if (white) {
colorMode(RGB);
fill(255, 255, 255);
} else {
colorMode(HSB, 100);
fill(Math.random() * 100, 100, 100);
}
noStroke();
ellipse(mouseX, mouseY, 20 + (r = 60 * Math.random()), 20 + r);
}

function mouseClicked() {
white = !white;
}
Loading

0 comments on commit 3e90fa1

Please sign in to comment.