Skip to content

Commit 8ab2ec3

Browse files
committed
Fix broken M_1_5_04
1 parent 85be443 commit 8ab2ec3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

02_M/M_1_5_04/Agent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ var Agent = function(noiseStickingRange, agentAlpha, noiseScale, noiseStrength,
33
this.vectorOld = this.vector.copy();
44
this.randomizer = myp5.random();
55
this.stepSize = 1 + this.randomizer * 4;
6-
this.zNoise = myp5.random(noiseStickingRange);
7-
this.angle;
6+
this.noiseZ = myp5.random(noiseStickingRange);
7+
this.angle = 0
88
this.color = this.randomizer < 0.5 ? myp5.color(myp5.random(170, 190), 70, myp5.random(100), agentAlpha) : myp5.color(myp5.random(40, 60), 70, myp5.random(100), agentAlpha);
99
this.noiseScale = noiseScale;
1010
this.noiseStrength = noiseStrength;
@@ -39,7 +39,7 @@ Agent.prototype.update1 = function() {
3939
myp5.strokeWeight(this.strokeWidth);
4040
myp5.line(this.vectorOld.x, this.vectorOld.y, this.vector.x, this.vector.y);
4141

42-
var agentWidth = myp5.lerp(this.agentWidthMin, this.agentWidthMax, this.randomizer);
42+
var agentWidth = myp5.map(this.randomizer, 0.1, 1, this.agentWidthMin, this.agentWidthMax);
4343
myp5.push();
4444
myp5.translate(this.vectorOld.x, this.vectorOld.y);
4545
myp5.rotate(myp5.atan2(this.vector.y - this.vectorOld.y, this.vector.x - this.vectorOld.x));
@@ -54,7 +54,7 @@ Agent.prototype.update2 = function() {
5454

5555
myp5.stroke(this.color);
5656
myp5.strokeWeight(2);
57-
var agentWidth = myp5.lerp(this.agentWidthMin, this.agentWidthMax, this.randomizer) * 2;
57+
var agentWidth = myp5.map(this.randomizer, 0.1, 1, this.agentWidthMin, this.agentWidthMax) * 2;
5858
myp5.ellipse(this.vectorOld.x, this.vectorOld.y, agentWidth, agentWidth);
5959

6060
this.updateEnd();

02_M/M_1_5_04/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var sketch = function(p) {
4848
p.colorMode(p.HSB, 360, 100, 100, 100);
4949

5050
for (var i = 0; i < agentCount; i++) {
51-
agents[i] = new Agent(noiseStickingRange, agentAlpha, noiseScale, noiseStrength, strokeWidth, agentWidthMin, agentWidthMax, zNoiseVelocity);
51+
agents.push(new Agent(noiseStickingRange, agentAlpha, noiseScale, noiseStrength, strokeWidth, agentWidthMin, agentWidthMax, zNoiseVelocity));
5252
}
5353
};
5454

0 commit comments

Comments
 (0)