Skip to content

Commit 67d7b8f

Browse files
authored
Merge pull request #29 from ThomasAbbink/e
E
2 parents abe467d + fd4726f commit 67d7b8f

File tree

18 files changed

+243
-83
lines changed

18 files changed

+243
-83
lines changed

package-lock.json

Lines changed: 157 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@vitejs/plugin-react-swc": "^3.7.0",
77
"h264-mp4-encoder": "^1.0.12",
88
"lygia": "^1.1.3",
9-
"p5": "^1.4.1",
9+
"p5": "^2.1.2",
1010
"react": "^18.3.1",
1111
"react-dom": "^18.3.1",
1212
"react-router": "^6.3.0",

public/assets/g2.png

51.5 KB
Loading

public/assets/g3.png

1.06 MB
Loading

public/assets/g5.png

840 KB
Loading

src/sketches/generative/PollockAreas/PollockAreas.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { getCanvasSize } from '../../../utility/canvas'
22
import area from './area'
3-
import { Vector } from 'p5'
43

54
export const pollockAreas = (p5) => {
65
const areas = []
@@ -30,7 +29,7 @@ export const pollockAreas = (p5) => {
3029
}
3130

3231
const addRandomArea = () => {
33-
const v = Vector.random2D()
32+
const v = p5.Vector.random2D()
3433
v.setMag(p5.random(50, width / 2))
3534
addArea(v)
3635
}

src/sketches/generative/PollockAreas/line.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Vector } from 'p5'
21
import { distanceSquared } from '../../../utility/vectors'
32

43
/**
@@ -12,13 +11,13 @@ const line = (p5) => {
1211
const position = p5.createVector(0, 0)
1312
let velocity = p5.createVector(0, 0)
1413
let acceleration = p5.createVector(0, 0)
15-
let target = Vector.random2D()
14+
let target = p5.Vector.random2D()
1615
let isMovingToCustomTarget = false
1716

1817
const moveRandomly = () => {
1918
isMovingToCustomTarget = false
2019
if (target.x === 0 && target.y === 0) {
21-
target = Vector.random2D()
20+
target = p5.Vector.random2D()
2221
}
2322
target.rotate(p5.random(p5.PI / 3, p5.PI / 2))
2423
target.setMag(10000)
@@ -61,7 +60,7 @@ const line = (p5) => {
6160
moveRandomly()
6261
}
6362

64-
acceleration = Vector.sub(target, position)
63+
acceleration = p5.Vector.sub(target, position)
6564
velocity.add(acceleration)
6665
velocity.limit(2)
6766
position.add(velocity)

0 commit comments

Comments
 (0)