LASTEST VERSION HERE : http://www.java-gaming.org/index.php/topic,22239.0.html
[s]EDIT :
look here for the lastest version :
It will be part of the next 3DzzD release but as this one is not yet ready and also beccause it can be used separatly, here it is.
http://demo.dzzd.net/Test/CAR.html
How to use it :
Put Boot.class, Boot$AppletLoader.class and an Image BLANK.GIF (wich will be the Java splash for recent JVM) on your remote server and replace BOOTCLASS parameter with your own applet class name.
I recommend to not pack it in a jar
The animation will play until the init method of the Applet return, so you may do all your initialisation and loading stuff inside the constructor or the init() method.
HTML code :
Java sources :
/*
* This file is part of 3DzzD http://dzzd.net/.
*
* Released under LGPL
*
* 3DzzD is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 3DzzD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with 3DzzD. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2005 - 2009 Bruno Augier
*/
import java.awt.*;
import java.applet.*;
import java.awt.image.*;
/**
* Boot
*
* An Applet Boot class
*
* @author Bruno Augier
* @website: http://dzzd.net/
* @version 1.00 2008/04/15
*/
public final class Boot extends Applet implements Runnable,AppletStub
{
private int nbStart=0;
private Graphics g;
private int bgColor;
Container c;
public boolean loaded;
public Thread t;
public Applet a;
private int w()
{
return this.getSize().width;
}
private int h()
{
return this.getSize().height;
}
private int nb=0;
private long lTime;
public void run()
{
try
{
this.lTime=System.currentTimeMillis();
while(!this.loaded)
{
int cx=this.w()>>1;
int cy=this.h()>>1;
for(int n=0;n<180;n++)
{
int r=255;
int v=165+(n>>1);
int b=75+n;
this.g.setColor(new Color(b|(v<<8)|(r<<16)));
double a=(nb-n*1.1)*Math.PI/180.0;
double ca=Math.cos(a);
double sa=Math.sin(a);
int x=cx+(int)(8.0*ca);
int y=cy+(int)(8.0*sa);
int x2=cx+(int)(12.0*ca);
int y2=cy+(int)(12.0*sa);
this.g.drawLine(x,y,x2,y2);
}
nb+=6;
long time=System.currentTimeMillis();
long delta=time-lTime;
lTime=time;
if(delta<20)
Thread.sleep(20-delta);
Thread.sleep(1);
}
}
catch(InterruptedException ie)
{
}
}
public void paint(Graphics g)
{
if(this.nbStart++==0)
{
String sBgColor=this.getParameter("BOOTBGCOLOR");
if(sBgColor!=null)
{
try
{
this.bgColor=Integer.parseInt(sBgColor,16);
}
catch(Exception e)
{
e.printStackTrace();
}
}
this.c=this.getParent();
this.g=this.c.getGraphics();
this.c.remove(this);
this.loaded=false;
this.t=new Thread(this);
this.t.start();
String bootClass=this.getParameter("BOOTCLASS");
new AppletLoader(bootClass);
}
Color color=new Color(this.bgColor);
this.c.setBackground(color);
this.g.setColor(color);
this.g.fillRect(0,0,w(),h());
super.paint(g);
}
private class AppletLoader implements Runnable
{
String name;
AppletLoader(String name)
{
this.name=name;
Thread t=new Thread(this);
t.start();
}
public void run()
{
try
{
Thread.sleep(2000);
a=(Applet)Class.forName(this.name).newInstance();
{
a.setStub(Boot.this);
a.setSize(w(),h());
a.init();
c.add(a);
a.start();
}
loaded=true;
t.join();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
public void start()
{
if(this.a!=null)
this.a.start();
}
public void stop()
{
if(this.a!=null)
this.a.stop();
}
public void destroy()
{
if(this.a!=null)
this.a.destroy();
this.a=null;
}
/*
public void update(Graphics g)
{
}*/
public void appletResize(int width, int height)
{
if(this.a!=null)
this.a.setSize(width,height);
}
}
[/s]