//stepmodel() if (tplot<tmax) { // This just defines where the brick is if (tplot>100) {ground=0.1;}; if (tplot>160) {ground=0.0;}; //work out the friction - try changing the values if(velocity>=0) {friction=-.5}; if(velocity<0) {friction= .5}; //update the variables acceleration=springcoeff*(ground-y)+friction; velocity=velocity+acceleration*dt; y=y+velocity*dt; tplot=tplot+scale*dt; // Move the picture MoveLayer(cube ,tplot+10,bbase-yscale*y); MoveLayer(wheel ,tplot+10,wbase-yscale*ground); MoveLayer(spring ,tplot+10,wbase-yscale*ground-60); MoveLayer(spring2,tplot+10,bbase-yscale*y+60); //round again setTimeout("stepmodel()",20); }else{ tplot=0; }