stuck on challenge many waves step 2
I am stuck on step 2 of challenge many waves. Here is my code:
angleMode = "radians";
var Wave = function(amplitude, period, color) {
this.startAngle = 0;
this.amplitude = amplitude;
this.period = period;
this.color = color;
this.angleVel = (TWO_PI / this.period) * 5;
};
Wave.prototype.update = function() {
var newWave = new Wave (this.amplitude,this.period, this.color);
this.startAngle += TWO_PI / this.period;
};
Wave.prototype.draw = function() {
background(252, 252, 252);
var angle = this.startAngle;
fill(this.color);
for (var x = 0; x <= width; x += 24) {
var y = this.amplitude * sin(angle);
ellipse(x, y, 48, 48);
angle += this.angleVel;
}
};
Log ind for at efterlade en kommentar.