Martina Matuella: Multi Random Movement 2 -> Erweiterung !!!

Beitrag lesen

Hallo an alle,

Wäre es möglich, bei nachfolgendem Script von Kurt Grigg die "gifs" durch onclick zum Explodieren zu bringen. Diese Idee verfolgt mich
schon seit vielen Monaten; mangels Java Kenntnissen jedoch für mich
nicht machbar.
Vielleicht hat Eine/r eine Ideee. Ich wäre um jeden Ansatz dankbar.

Grüße
Martina

<script language="JavaScript" type="text/javascript">
<!-- Multi Random Movement 2 Script by kurt.grigg@virgin.net

Pic=new Array('1a.gif','2a.gif','3a.gif','4a.gif','5a.gif','6a.gif','7a.gif','1a.gif','3a.gif','4a.gif','5a.gif','6a.gif','7a.gif')
MaxSpeed=3;
MinSpeed=1;

/************************ Nothing needs altering below ************************/
load = new Array()
for(i=0; i < Pic.length; i++)
 {
 load[i] = new Image();
 load[i].src = Pic[i];
 }
n=Pic.length;
n6=(document.getElementById&&!document.all);
ns=(document.layers);
ie=(document.all);
d=(ns||ie)?'document.':'document.getElementById("';
a=(ns||n6)?'':'all.';
n6r=(n6)?'")':'';
s=(ns)?'':'.style';
if (ns){
for (i=0; i < n; i++)
document.write("<LAYER NAME='pics"+i+"' LEFT=0 TOP=0><img name='netpics' src="+load[i].src+"></LAYER>");
}
if (ie||n6){
for (i=0; i < n; i++)
document.write("<div id='pics"+i+"' style='position:absolute;top:0px;left:0px'><img src="+load[i].src+"></div>");
}
VB=0;
HB=0;
R=new Array();
PB=new Array();
RD=new Array();
Y=new Array();
X=new Array();
D=new Array();
SP=new Array();
BY=new Array();
BX=new Array();
for (i=0; i < n; i++){
 Y[i]=10;
 X[i]=10;
 D[i]=Math.floor(Math.random()*70+10);
 SP[i]=Math.floor(Math.random()*MaxSpeed+MinSpeed);
}
function Curve(){
plusMinus=new Array(1,-1,2,-2,3,-3,0,1,-1,0,5,-5)
for (i=0; i < n; i++){
R[i]=Math.floor(Math.random()*plusMinus.length);
RD[i]=plusMinus[R[i]];
}
setTimeout('Curve()',1500);
}
function MoveRandom(){
var H=(ns||n6)?window.innerHeight:document.body.clientHeight;
var W=(ns||n6)?window.innerWidth:document.body.clientWidth;
var YS=(ns||n6)?window.pageYOffset:document.body.scrollTop;
var XS=(ns||n6)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i < n; i++){
BY[i]=-load[i].height;
BX[i]=-load[i].width;
PB[i]=D[i]+=RD[i];
y = SP[i]*Math.sin(PB[i]*Math.PI/180);
x = SP[i]*Math.cos(PB[i]*Math.PI/180);
if (D[i] < 0) D[i]+=360;
Y[i]+=y;
X[i]+=x;
VB=180-D[i];
HB=0-D[i];
//Corner rebounds! not necessary but looks nice.
if ((Y[i] < 1) && (X[i] < 1)) {Y[i]=1;X[i]=1;D[i]=45;}
if ((Y[i] < 1) && (X[i] > W+BX[i])) {Y[i]=1;X[i]=W+BX[i];D[i]=135;}
if ((Y[i] > H+BY[i]) && (X[i] < 1)) {Y[i]=H+BY[i];X[i]=1;D[i]=315;}
if ((Y[i] > H+BY[i]) && (X[i] > W+BX[i])) {Y[i]=H+BY[i];X[i]=W+BX[i];D[i]=225;}
//Edge rebounds!
if (Y[i] < 1) {Y[i]=1;D[i]=HB;}
if (Y[i] > H+BY[i]) {Y[i]=H+BY[i];D[i]=HB;}
if (X[i] < 1) {X[i]=1;D[i]=VB;}
if (X[i] > W+BX[i]) {X[i]=W+BX[i];D[i]=VB;}
var temp=eval(d+a+"pics"+i+n6r+s);
temp.top=Y[i]+YS;
temp.left=X[i]+XS;
}
setTimeout('MoveRandom()',10);
}
Curve();
MoveRandom();
//-->
</script>