import java.awt.*; import java.applet.*; import java.awt.image.*; public class Surface { int WIDTH; int HEIGHT; int mouseX; int mouseY; boolean theMouseDown; int xArray[]; int yArray[]; int nPoints; int moveX; int sizeOfOneCycle; int amplitude; Color grayBlue = new Color(180,200,255); public Surface (int w, int h){ WIDTH = w; HEIGHT = h; mouseX = 0; mouseY = 0; theMouseDown = false; } public void initialize(){ nPoints = WIDTH * 4; xArray = new int[nPoints]; yArray = new int[nPoints]; moveX = 0; sizeOfOneCycle = nPoints; } public void paint (Graphics G){ int r,g,b; g = b = 0; r = 255; G.setColor(Color.white); G.drawRect(0,0,480,480); double sineHolder = 0; int centerObject = WIDTH/2; //for(int yPos = 0;yPos < 5; yPos++){ for(double i=0;i 0 && g==255 && b == 0) r-=5; else if(r==0 && g == 255 && b<255) b+=5; else if(r==0 && g > 0 &&b == 255) g-=5; else if(r<255 && g == 0 && b ==255) r+=5; else if(r == 255 && g == 0 && b > 0) b-=5; G.setColor(new Color(r,g,b)); //G.setColor(grayBlue); //G.drawOval((xArray[(int)i]),yArray[(int)i],1,1); G.drawOval((xArray[(int)i] + sizeOfOneCycle/2),yArray[(int)i],10,10); //G.drawLine((xArray[(int)i]),yArray[(int)i],xArray[(int)i+1],yArray[(int)i+1]); //G.drawLine((xArray[(int)i] + sizeOfOneCycle/2),yArray[(int)i], // (xArray[(int)i+1] + sizeOfOneCycle/2),yArray[(int)i+1]); } } //} } public void compute(){ moveX += 10; moveX = moveX % ((sizeOfOneCycle) * 4); } //------------------------------------------------------- // events public void keyDown(char key) { } public void mouseDown (int x, int y){ mouseX = x; mouseY = y; theMouseDown = true; } public void mouseMove (int x, int y){ mouseX = x; mouseY = y; theMouseDown = false; } public void mouseUp (int x, int y){ mouseX = x; mouseY = y; theMouseDown = false; } public void mouseDrag (int x, int y){ mouseX = x; mouseY = y; theMouseDown = true; } } //______________________________________________________________________ /*Grave Yard G.drawOval((yArray[(int)i]),xArray[(int)i] + moveX,1,1); G.drawOval((yArray[(int)i]) ,xArray[(int)i] + 120 + moveX,10,10); G.drawOval((xArray[(int)i]) - 30 + moveX,yArray[(int)i] + 120,1,1); G.drawOval((xArray[(int)i] - 30 + 120) + (moveX),yArray[(int)i] + 120,10,10); //G.drawOval(240,yArray[(int)i],4,4); */