/// mod to ralph's slinky /// not able to write any new math /// just trying to get this done today... /// sadly, g. craig hobbs // get some variables (dimensions of our angle) int x0 = 100; // have to declare the type in P int y0 = 250; // have to declare the type in P int dx = 25; // width of step int dy = 25; // height of riser int ex = 0; // length to erase // setup the canvas void setup(){ size(400, 400); // do not want to change this later frameRate(10); // fast } // draw some lines void draw(){ PImage b; b = loadImage("stairwell.jpg"); background(b); stroke(223, 20, 20); // draw5(); ex = ex + 1; // incr erase each frame // print(frameCount); // debug line if (frameCount == 10){ ex = 0; // reset eraser stroke(223, 20, 20); // change color x0 = x0 + dx; // change position y0 = y0 + dy; } draw5(); ex = ex + 1; // incr erase each frame // print(frameCount); // debug line if (frameCount == 20){ ex = 0; // reset eraser stroke(223, 20, 20); // change color x0 = x0 + dx; // change position y0 = y0 + dy; } draw5(); ex = ex + 1; // incr erase each frame // print(frameCount); // debug line if (frameCount == 30){ ex = 0; // reset eraser stroke(223, 20, 20); // change color x0 = x0 + dx; // change position y0 = y0 + dy; } draw5(); ex = ex + 1; // incr erase each frame // print(frameCount); // debug line if (frameCount == 40){ ex = 0; // reset eraser stroke(223, 20, 20); // change color x0 = x0 + dx; // change position y0 = y0 + dy; } } void draw1(int cx, int cy){ noFill(); smooth(); strokeWeight(2.0); int u = x0 + cx; // offset x int v = y0 + cy; // offset x if (ex < dx){ beginShape(); vertex(u + ex, v); // x0 + dx, y0); // first step vertex(u + dx, v); // x0 + dx, y0 + dy); // fixed riser vertex(u + dx, v + dy); // ); // second step vertex(u + dx + ex, v + dy); // end point endShape(); } } void draw5(){ draw1(0, 0); // do the shape draw1(10, -10); // do the shape draw1(20, -20); // do the shape draw1(30, -30); // do the shape draw1(40, -40); // do the shape draw1(50, -50); // do the shape } //// end