float x;
float theta =0;
void setup() {
size(600, 600);
}
void draw() {
background(255);
fill(0);
strokeWeight(2);
rect(30, 200, 100, 100);
line(30, 200, 400, 200);
line(50, 300, 400, 300);
line(30, 300, 30, 450);
line(30, 450, 400, 450);
line(400, 200, 400,550);
line(380,550,420,550);
line(390,560,410,560);
line(395,570,405,570);
fill(255);
stroke(0);
strokeWeight(5);
beginShape(TRIANGLES);
vertex(400,300);
vertex(400,200);
vertex(550, 250);
endShape();
line(381,551,421,551);
line(391,561,411,561);
line(396,571,406,571);
fill(127);
rect(260, 170, 150, 60);
rect(260, 270, 150, 60);
float lX=0;
float lY2=0;
float lY=0;
float lY3=0;
println(x);
theta=theta +0.05;
float y = theta;
for (int i = 0; i<=15; i++) {
x = sin(y);
line((i*10)+130, 200+(50*x), lX, lY);
line((i*10)+130, 300+(50*x), lX, lY2);
line((i*10)+130, 300+(50*x), lX, lY3);
// ellipse(i*10, 100+(100*x), 10, 10);
lX = (i*10)+130;
lY2 = 300+(50*x);
lY = 200+(50*x);
lY3 = 300+(50*x);
y+=0.9;
}
}
Here is the code for what I have got so far. I’m having trouble with the sine waves. I cant seem to add two more and move them into the box like they are in the picture. Mine are also slightly too big and there are straight lines coming out of the back of them. Also I’m trying to make the bottom one of the first two waves out of phase. I’d appreciate any help guys thanks!