import java.applet.Applet; import java.awt.event.*; import java.awt.*; import java.awt.geom.*; public class test1 extends Applet { MotionCanvas I; Animator A; ControlCanvas C; public void init() { A=new Animator(); setBackground(Color.black); C=new ControlCanvas(); C.setBackground(Color.black); MotionCanvas I=new MotionCanvas(A); C=C.addMotionCanvas(I); C.resize(150,250); I.resize(150,150); I.setBackground(Color.black); A=A.addMotionCanvas(I); add(C); add(I); try {A.start();} catch(Exception e) {} } } class DBCanvas extends Canvas { public void update(Graphics g) { Graphics g2; Image offscreen = null; offscreen = createImage(size().width, size().height); g2 = offscreen.getGraphics(); paint(g2); g.drawImage(offscreen, 0, 0, this); g2.dispose(); offscreen.flush(); } } class MotionCanvas extends DBCanvas { Animator A; int number,length; double mesh; MotionCanvas(Animator A) { this.A=A; number=25; mesh=0; length=75; } public void paint(Graphics gfx) { Graphics2D g=(Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); double ii=A.getCount(mesh); int pow=1; g.setColor(Color.white); for(int i=1;i<=number;++i) { double x=length*Math.cos(pow*2.0*Math.PI*ii); double y=length*Math.sin(pow*2.0*Math.PI*ii); pow=1+pow; g.drawLine(75,75,(int)(x+75),(int)(y+75)); } } } class VSlider { int x,y,w,h; int pos; Color[] C; String S; VSlider(int x,int y,int w,int h,int pos,Color[] C,String S) { this.x=x; this.y=y; this.h=h; this.w=w; this.pos=pos; this.C=C; this.S=S; } void render(Graphics g) { g.setColor(C[1]); g.fillRect(x,y,w,h); g.setColor(C[2]); g.drawRect(x,y,w,h); g.setColor(C[3]); g.drawRect(x+1,pos-1,w-2,2); g.setColor(C[2]); g.setFont(new Font("TimesRoman",Font.PLAIN,13)); g.drawString(S,x,y+h+12); } int inside(Point p) { int test=0; if((p.x>x)&&(p.xy)&&(p.y