import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.Dimension;
public class spiralthingy extends JApplet
{
public static Color colors [] = new Color [510];
private Image bImage;
private Graphics bg;
private Graphics2D g2d;
private int width, height;
private boolean drawnonce = false;
public void init ()
{
setBackground (Color.black);
width = 800;
height = 600;
resize (width, height);
for (int i = 0 ; i < 255 ; i++)
{
colors [i] = new Color (i, i, i);
}
for (int i = 255 ; i < 255 * 2 ; i++)
{
colors [i] = new Color (255 - (i - 255), 255 - (i - 255), 255 - (i - 255));
}
}
private void drawonce (Graphics bg)
{
double modes=10;
double zoom = 3;
double xx = 0, yy = 0, lx, ly;
if (drawnonce == false)
{
drawnonce = true;
///////////////////////////////////////////Drawn Code Here\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
for (double j = 1 ; j < 1000 ; j += 1)
{
for (double i = 0 ; i < modes ; i += .01)
{
//bg.setColor (colors [(int) ((i * 100) % 510)]);
bg.setColor (Color.white);
lx = xx;
ly = yy;
xx += Math.cos ((i * j) * (i * j));
yy += Math.sin ((i * j) * (i * j));
bg.drawLine ((int) (lx / zoom) + 10, (int) (ly / zoom) + 10, (int) (xx / zoom) + 10, (int) (yy / zoom) + 10);
}
updateScreen ();
}
///////////////////////////////////////////Drawn Code Ends Here\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
}
}
public void paint (Graphics g)
{
g2d = (Graphics2D) g;
bImage = createImage (width, height);
bg = bImage.getGraphics ();
drawonce (bg);
bg.dispose ();
bImage.flush ();
}
private void updateScreen ()
{
g2d.drawImage (bImage, 0, 0, this);
}
}
|