-
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.
- Loading branch information
Donnie Flood
committed
Oct 28, 2019
1 parent
24de8b1
commit aaf0e68
Showing
4 changed files
with
37 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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
## Commands | ||
|
||
* `npm run sketch -- path/to/file.js --open` | ||
* `npm run parcel -- path/to/file` |
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,7 @@ | ||
<html> | ||
|
||
<body> | ||
<script src="./p.1.1.1.ts"></script> | ||
</body> | ||
|
||
</html> |
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 |
---|---|---|
|
@@ -20,4 +20,4 @@ function sketch(p: p5) { | |
}; | ||
} | ||
|
||
new p5(sketch); | ||
new p5(sketch); |
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,28 @@ | ||
import p5 from "p5"; | ||
|
||
// Generative Design P.1.0 | ||
function sketch(p: p5) { | ||
let stepX: number, stepY: number; | ||
const y = 100; | ||
|
||
p.setup = () => { | ||
p.createCanvas(800, 400); | ||
p.background(0); | ||
}; | ||
|
||
p.draw = () => { | ||
p.colorMode("hsb", p.width, p.height, 100); | ||
|
||
stepX = p.mouseX + 2; | ||
stepY = p.mouseY + 2; | ||
|
||
for (let gridY = 0; gridY < p.height; gridY += stepY) { | ||
for (let gridX = 0; gridX < p.width; gridX += stepX) { | ||
p.fill(gridX, p.height - gridY, 100); | ||
p.rect(gridX, gridY, stepX, stepY); | ||
} | ||
} | ||
} | ||
} | ||
|
||
new p5(sketch); |