@dekha
untuk menghindari kelebihan bandwidth...
mendingan di-pisahin aja tuh js n css'e..
neh saya udah pisahin..
tolong repost ke first post
[quote][li]untuk css-nya[/li]
[spoiler]
.asf {
position:absolute;
z-index:0;
width:0;
height:0;
left:-1000px;
top:0px;
}
.asd {
position:absolute;
z-index:30;
width:500;
height:100;
left:300px;
top:0px;
}
[/spoiler]
[li]untuk js-pertama-nya[/li]
[spoiler]
var AMXq=5;
var debugAMX=false;
var images_basic_path = "http://www.singyfamily.com/Hob/tech/aniMagiX/gecko/";
function setSpriteObjects(){
if(body_height<win_height)
hh=win_height;
else
hh=body_height;
for(i=0;i<AMXq;i++){
if(AMXrnd()>0){
if(AMXrnd()>.75)
AMXs[i]=new sprite('g0','waituprightB1',-200*(1+AMXrnd()),win_height*AMXrnd(),states['g0'].z,-200,-200,body_width,hh);
else
if(AMXrnd()>.66)
AMXs[i]=new sprite('g0','waitdownrightA2',body_width*AMXrnd(),-200*(1+AMXrnd()),states['g0'].z,-200,-200,body_width,hh);
else
if(AMXrnd()>.5)
AMXs[i]=new sprite('g0','waitdownrightA2',-200*(1+AMXrnd()),win_height*AMXrnd(),states['g0'].z,-200,-200,body_width,hh);
else
AMXs[i]=new sprite('g0','downleftA',body_width*AMXrnd(),-200*(1+AMXrnd()),states['g0'].z,-200,-200,body_width,hh);
}
}
}
function initStates(){
states=new Array;
st_n="g0";
states[st_n]=new state;
states[st_n].onErrorScenario="waituprightA1";
states[st_n].z

;
states[st_n].scenarios["uprightA"]=new scenario;
with(states[st_n].scenarios["uprightA"]){
random_delay=5;
steps[0]=new step(st_n,"gur2.gif",19,-35,2);
steps[1]=new step(st_n,"gur4.gif",19,-43,2);
steps[2]=new step(st_n,"gur2.gif",19,-35,2);
steps[3]=new step(st_n,"gur4.gif",19,-43,2);
next_scenarios[0]=new next_scenario("uprightA",5);
next_scenarios[1]=new next_scenario("circle",1);
next_scenarios[2]=new next_scenario("waituprightA1",4);
next_scenarios[3]=new next_scenario("waituprightA2",3);
next_scenarios[4]=new next_scenario("waituprightA3",15);
next_scenarios[5]=new next_scenario("waituprightA4",4);
next_scenarios[6]=new next_scenario("uprightB",5);
next_states[0]=new next_state("g0","uprightA",99);
onright_next_states[0]=new next_state("g0","upleftA",49);
onright_next_states[0].action="boomright()";
ontop_next_states[0]=new next_state("g0","downrightA",49);
ontop_next_states[0].action="boomTop()";
onclick_zones[0]=new on_zone(0,0,115,115);
onclick_zones[0].next_states[0]=new next_state("g0","circle",10);
onclick_zones[0].next_states[0].action="shake()";
}
states[st_n].scenarios["waituprightA1"]=new scenario;
with(states[st_n].scenarios["waituprightA1"]){
random_delay=140;
steps[0]=new step(st_n,"gur2.gif",0,0,2);
steps[1]=new step(st_n,"gur21.gif",0,0,62);
steps[2]=new step(st_n,"gur22.gif",0,0,12);
steps[3]=new step(st_n,"gur21.gif",0,0,12);
steps[4]=new step(st_n,"gur22.gif",0,0,12);
steps[5]=new step(st_n,"gur21.gif",0,0,22);
steps[6]=new step(st_n,"gur2.gif",0,0,12);
steps[7]=new step(st_n,"gur22.gif",0,0,22);
steps[8]=new step(st_n,"gur21.gif",0,0,12);
next_scenarios[0]=new next_scenario("waituprightA1",10);
next_scenarios[1]=new next_scenario("waituprightA11",10);
next_scenarios[2]=new next_scenario("uprightA",3);
next_states[0]=new next_state("g0","waituprightA1",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","uprightA",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","uprightB",2);
}
states[st_n].scenarios["waituprightA2"]=new scenario;
with(states[st_n].scenarios["waituprightA2"]){
random_delay=40;
steps[0]=new step(st_n,"gur4.gif",0,0,12);
steps[1]=new step(st_n,"gur41.gif",0,0,12);
steps[2]=new step(st_n,"gur4.gif",0,0,12);
steps[3]=new step(st_n,"gur41.gif",0,0,12);
steps[4]=new step(st_n,"gur42.gif",0,0,12);
steps[5]=new step(st_n,"gur41.gif",0,0,12);
steps[6]=new step(st_n,"gur42.gif",0,0,12);
steps[7]=new step(st_n,"gur41.gif",0,0,2);
steps[8]=new step(st_n,"gur4.gif",0,0,12);
steps[9]=new step(st_n,"gur42.gif",0,0,122);
steps[10]=new step(st_n,"gur41.gif",0,0,12);
steps[11]=new step(st_n,"gur42.gif",0,0,12);
steps[12]=new step(st_n,"gur41.gif",0,0,2);
next_scenarios[0]=new next_scenario("waituprightA2",20);
next_scenarios[1]=new next_scenario("uprightA",5);
next_states[0]=new next_state("g0","waituprightA1",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","uprightA",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","uprightB",2);
}
states[st_n].scenarios["waituprightA11"]=new scenario;
with(states[st_n].scenarios["waituprightA11"]){
random_delay=70;
steps[0]=new step(st_n,"gur1.gif",0,0,12);
steps[1]=new step(st_n,"gur11.gif",0,0,12);
steps[2]=new step(st_n,"gur1.gif",0,0,12);
steps[3]=new step(st_n,"gur11.gif",0,0,12);
steps[4]=new step(st_n,"gur1.gif",0,0,12);
steps[5]=new step(st_n,"gur11.gif",0,0,12);
next_scenarios[0]=new next_scenario("waituprightA1",10);
next_scenarios[1]=new next_scenario("waituprightA11",20);
next_scenarios[2]=new next_scenario("uprightA",10);
next_scenarios[3]=new next_scenario("waituprightA3",10);
next_states[0]=new next_state("g0","waituprightA1",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","uprightA",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","uprightB",2);
}
states[st_n].scenarios["waituprightA3"]=new scenario;
with(states[st_n].scenarios["waituprightA3"]){
random_delay=40;
steps[0]=new step(st_n,"gur41.gif",0,0,1);
steps[1]=new step(st_n,"gur43.gif",0,0,2);
steps[2]=new step(st_n,"gur44.gif",0,0,122);
next_scenarios[0]=new next_scenario("waituprightA3out2",4);
next_scenarios[1]=new next_scenario("uprightA",11);
next_states[0]=new next_state("g0","waituprightA3",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","uprightA",50);
}
states[st_n].scenarios["waituprightA3out2"]=new scenario;
with(states[st_n].scenarios["waituprightA3out2"]){
random_delay=40;
steps[0]=new step(st_n,"gur43.gif",0,0,0);
steps[1]=new step(st_n,"gur42.gif",0,0,2);
steps[2]=new step(st_n,"gur41.gif",0,0,12);
next_scenarios[0]=new next_scenario("uprightA",11);
next_scenarios[1]=new next_scenario("waituprightA3",4);
next_states[0]=new next_state("g0","waituprightA3",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","uprightA",50);
}
states[st_n].scenarios["waituprightA4"]=new scenario;
with(states[st_n].scenarios["waituprightA4"]){
random_delay=40;
steps[0]=new step(st_n,"gur2.gif",0,0,2);
steps[1]=new step(st_n,"gur49.gif",-14,-11,215);
steps[2]=new step(st_n,"gur21.gif",14,11,2);
steps[3]=new step(st_n,"gur2.gif",0,0,2);
next_scenarios[0]=new next_scenario("waituprightA1",4);
next_scenarios[1]=new next_scenario("uprightA",2);
next_states[0]=new next_state("g0","waituprightA4",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","uprightA",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","uprightB",2);
}
states[st_n].scenarios["uprightB"]=new scenario;
with(states[st_n].scenarios["uprightB"]){
random_delay=5;
steps[0]=new step(st_n,"gurB2.gif",35,-19,2);
steps[1]=new step(st_n,"gurB4.gif",43,-19,2);
steps[2]=new step(st_n,"gurB2.gif",35,-19,2);
steps[3]=new step(st_n,"gurB4.gif",43,-19,2);
next_scenarios[0]=new next_scenario("uprightB",6);
next_scenarios[1]=new next_scenario("waituprightB1",6);
next_scenarios[2]=new next_scenario("downrightB",1);
next_states[0]=new next_state("g0","uprightB",99);
onright_next_states[0]=new next_state("g0","upleftB",49);
onright_next_states[0].action="boomright()";
ontop_next_states[0]=new next_state("g0","downrightB",49);
ontop_next_states[0].action="boomTop()";
onclick_zones[0]=new on_zone(0,0,115,115);
onclick_zones[0].next_states[0]=new next_state("g0","circle",10);
onclick_zones[0].next_states[0].action="shake()";
}
states[st_n].scenarios["waituprightB1"]=new scenario;
with(states[st_n].scenarios["waituprightB1"]){
random_delay=40;
steps[0]=new step(st_n,"gurB2.gif",0,0,2);
steps[1]=new step(st_n,"gurB21.gif",0,0,12);
steps[2]=new step(st_n,"gurB22.gif",0,0,12);
steps[3]=new step(st_n,"gurB21.gif",0,0,12);
steps[4]=new step(st_n,"gurB22.gif",0,0,12);
steps[5]=new step(st_n,"gurB21.gif",0,0,12);
steps[6]=new step(st_n,"gurB22.gif",0,0,12);
steps[7]=new step(st_n,"gurB21.gif",0,0,12);
next_scenarios[0]=new next_scenario("waituprightB1",10);
next_scenarios[1]=new next_scenario("uprightB",2);
next_states[0]=new next_state("g0","waituprightB1",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","uprightB",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","uprightB",2);
}
states[st_n].scenarios["downrightA"]=new scenario;
with(states[st_n].scenarios["downrightA"]){
random_delay=5;
steps[0]=new step(st_n,"gdr2.gif",35,19,2);
steps[1]=new step(st_n,"gdr4.gif",43,19,2);
steps[2]=new step(st_n,"gdr2.gif",35,19,2);
steps[3]=new step(st_n,"gdr4.gif",43,19,2);
next_scenarios[0]=new next_scenario("downrightA",11);
next_scenarios[1]=new next_scenario("waitdownrightA2",11);
next_scenarios[2]=new next_scenario("uprightA",4);
next_scenarios[3]=new next_scenario("circle",3);
next_scenarios[4]=new next_scenario("downrightB",11);
next_states[0]=new next_state("g0","downrightA",99);
onright_next_states[0]=new next_state("g0","downleftA",49);
onright_next_states[0].action="boomright()";
onbottom_next_states[0]=new next_state("g0","uprightA",49);
onbottom_next_states[0].action="boomBottom()";
onclick_zones[0]=new on_zone(0,0,115,115);
onclick_zones[0].next_states[0]=new next_state("g0","circle",10);
onclick_zones[0].next_states[0].action="shake()";
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","circle",2);
}
states[st_n].scenarios["waitdownrightA2"]=new scenario;
with(states[st_n].scenarios["waitdownrightA2"]){
random_delay=40;
steps[0]=new step(st_n,"gdr4.gif",0,0,12);
steps[1]=new step(st_n,"gdr41.gif",0,0,12);
steps[2]=new step(st_n,"gdr4.gif",0,0,12);
steps[3]=new step(st_n,"gdr41.gif",0,0,12);
steps[4]=new step(st_n,"gdr42.gif",0,0,12);
steps[5]=new step(st_n,"gdr41.gif",0,0,12);
steps[6]=new step(st_n,"gdr42.gif",0,0,12);
steps[7]=new step(st_n,"gdr41.gif",0,0,2);
steps[8]=new step(st_n,"gdr4.gif",0,0,12);
steps[9]=new step(st_n,"gdr42.gif",0,0,122);
steps[10]=new step(st_n,"gdr41.gif",0,0,12);
steps[11]=new step(st_n,"gdr42.gif",0,0,12);
steps[12]=new step(st_n,"gdr41.gif",0,0,2);
next_scenarios[0]=new next_scenario("waitdownrightA2",2);
next_scenarios[1]=new next_scenario("downrightA",20);
next_scenarios[2]=new next_scenario("circle",1);
next_states[0]=new next_state("g0","waitdownrightA2",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","downrightA",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","downrightB",2);
}
states[st_n].scenarios["downrightB"]=new scenario;
with(states[st_n].scenarios["downrightB"]){
random_delay=5;
steps[0]=new step(st_n,"gdrB2.gif",19,35,2);
steps[1]=new step(st_n,"gdrB4.gif",19,43,2);
steps[2]=new step(st_n,"gdrB2.gif",19,35,2);
steps[3]=new step(st_n,"gdrB4.gif",19,43,2);
next_scenarios[0]=new next_scenario("downrightB",8);
next_scenarios[1]=new next_scenario("downrightA",2);
next_states[0]=new next_state("g0","downrightB",99);
next_states[1]=new next_state("g0","downleftB",99);
next_states[2]=new next_state("g0","uprightB",99);
onright_next_states[0]=new next_state("g0","downleftB",49);
onright_next_states[0].action="boomright()";
onbottom_next_states[0]=new next_state("g0","uprightB",49);
onbottom_next_states[0].action="boomBottom()";
onclick_zones[0]=new on_zone(0,0,115,115);
onclick_zones[0].next_states[0]=new next_state("g0","circle",10);
onclick_zones[0].next_states[0].action="shake()";
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","circle",2);
}
states[st_n].scenarios["downleftA"]=new scenario;
with(states[st_n].scenarios["downleftA"]){
random_delay=5;
steps[0]=new step(st_n,"gdl2.gif",-19,35,2);
steps[1]=new step(st_n,"gdl4.gif",-19,43,2);
steps[2]=new step(st_n,"gdl2.gif",-19,35,2);
steps[3]=new step(st_n,"gdl4.gif",-19,43,2);
next_scenarios[0]=new next_scenario("downleftA",6);
next_scenarios[1]=new next_scenario("downleftB",1);
next_states[0]=new next_state("g0","downleftA",99);
onleft_next_states[0]=new next_state("g0","downrightA",49);
onleft_next_states[0].action="boomleft()";
onbottom_next_states[0]=new next_state("g0","upleftA",49);
onbottom_next_states[0].action="boomBottom()";
onclick_zones[0]=new on_zone(0,0,115,115);
onclick_zones[0].next_states[0]=new next_state("g0","circle",10);
onclick_zones[0].next_states[0].action="shake()";
}
states[st_n].scenarios["downleftB"]=new scenario;
with(states[st_n].scenarios["downleftB"]){
random_delay=5;
steps[0]=new step(st_n,"gdlB2.gif",-35,19,2);
steps[1]=new step(st_n,"gdlB4.gif",-43,19,2);
steps[2]=new step(st_n,"gdlB2.gif",-35,19,2);
steps[3]=new step(st_n,"gdlB4.gif",-43,19,2);
next_scenarios[0]=new next_scenario("downleftB",21);
next_scenarios[1]=new next_scenario("waitdownleftB2",11);
next_scenarios[2]=new next_scenario("upleftB",4);
next_scenarios[3]=new next_scenario("circle",3);
next_scenarios[4]=new next_scenario("downleftA",3);
next_states[0]=new next_state("g0","downleftB",99);
onleft_next_states[0]=new next_state("g0","downrightB",49);
onleft_next_states[0].action="boomleft()";
onbottom_next_states[0]=new next_state("g0","upleftB",49);
onbottom_next_states[0].action="boomBottom()";
onclick_zones[0]=new on_zone(0,0,115,115);
onclick_zones[0].next_states[0]=new next_state("g0","circle",10);
onclick_zones[0].next_states[0].action="shake()";
}
states[st_n].scenarios["waitdownleftB2"]=new scenario;
with(states[st_n].scenarios["waitdownleftB2"]){
random_delay=40;
steps[0]=new step(st_n,"gdlB4.gif",0,0,12);
steps[1]=new step(st_n,"gdlB41.gif",0,0,12);
steps[2]=new step(st_n,"gdlB4.gif",0,0,12);
steps[3]=new step(st_n,"gdlB41.gif",0,0,12);
steps[4]=new step(st_n,"gdlB42.gif",0,0,12);
steps[5]=new step(st_n,"gdlB41.gif",0,0,12);
steps[6]=new step(st_n,"gdlB42.gif",0,0,12);
steps[7]=new step(st_n,"gdlB41.gif",0,0,2);
steps[8]=new step(st_n,"gdlB4.gif",0,0,12);
steps[9]=new step(st_n,"gdlB42.gif",0,0,122);
steps[10]=new step(st_n,"gdlB41.gif",0,0,12);
steps[11]=new step(st_n,"gdlB42.gif",0,0,12);
steps[12]=new step(st_n,"gdlB41.gif",0,0,2);
next_scenarios[0]=new next_scenario("waitdownleftB2",2);
next_scenarios[1]=new next_scenario("downleftB",20);
next_scenarios[2]=new next_scenario("circle",1);
next_states[0]=new next_state("g0","waitdownleftB2",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","downleftB",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","downleftA",2);
}
states[st_n].scenarios["upleftA"]=new scenario;
with(states[st_n].scenarios["upleftA"]){
random_delay=5;
steps[0]=new step(st_n,"gul2.gif",-35,-19,2);
steps[1]=new step(st_n,"gul4.gif",-43,-19,2);
steps[2]=new step(st_n,"gul2.gif",-35,-19,2);
steps[3]=new step(st_n,"gul4.gif",-43,-19,2);
next_scenarios[0]=new next_scenario("upleftA",6);
next_scenarios[1]=new next_scenario("waitupleftA1",6);
next_scenarios[2]=new next_scenario("downleftA",1);
next_states[0]=new next_state("g0","upleftA",99);
onleft_next_states[0]=new next_state("g0","uprightA",49);
onleft_next_states[0].action="boomleft()";
ontop_next_states[0]=new next_state("g0","downleftA",49);
ontop_next_states[0].action="boomTop()";
onclick_zones[0]=new on_zone(0,0,115,115);
onclick_zones[0].next_states[0]=new next_state("g0","circle",10);
onclick_zones[0].next_states[0].action="shake()";
}
states[st_n].scenarios["waitupleftA1"]=new scenario;
with(states[st_n].scenarios["waitupleftA1"]){
random_delay=40;
steps[0]=new step(st_n,"gul2.gif",0,0,2);
steps[1]=new step(st_n,"gul21.gif",0,0,62);
steps[2]=new step(st_n,"gul22.gif",0,0,12);
steps[3]=new step(st_n,"gul21.gif",0,0,12);
steps[4]=new step(st_n,"gul22.gif",0,0,12);
steps[5]=new step(st_n,"gul21.gif",0,0,22);
steps[6]=new step(st_n,"gul22.gif",0,0,12);
steps[7]=new step(st_n,"gul21.gif",0,0,22);
next_scenarios[0]=new next_scenario("waitupleftA1",10);
next_scenarios[1]=new next_scenario("upleftA",2);
next_states[0]=new next_state("g0","waitupleftA1",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","upleftA",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","upleftB",2);
}
states[st_n].scenarios["upleftB"]=new scenario;
with(states[st_n].scenarios["upleftB"]){
random_delay=5;
steps[0]=new step(st_n,"gulB2.gif",-19,-35,2);
steps[1]=new step(st_n,"gulB4.gif",-19,-43,2);
steps[2]=new step(st_n,"gulB2.gif",-19,-35,2);
steps[3]=new step(st_n,"gulB4.gif",-19,-43,2);
next_scenarios[0]=new next_scenario("upleftB",5);
next_scenarios[1]=new next_scenario("circle",1);
next_scenarios[2]=new next_scenario("waitupleftB1",4);
next_scenarios[3]=new next_scenario("waitupleftB2",3);
next_scenarios[4]=new next_scenario("upleftA",5);
next_states[0]=new next_state("g0","uprightA",99);
onleft_next_states[0]=new next_state("g0","uprightB",49);
onleft_next_states[0].action="boomleft()";
ontop_next_states[0]=new next_state("g0","downrightB",49);
ontop_next_states[0].action="boomTop()";
onclick_zones[0]=new on_zone(0,0,115,115);
onclick_zones[0].next_states[0]=new next_state("g0","circle",10);
onclick_zones[0].next_states[0].action="shake()";
}
states[st_n].scenarios["waitupleftB1"]=new scenario;
with(states[st_n].scenarios["waitupleftB1"]){
random_delay=40;
steps[0]=new step(st_n,"gulB2.gif",0,0,2);
steps[1]=new step(st_n,"gulB21.gif",0,0,62);
steps[2]=new step(st_n,"gulB22.gif",0,0,12);
steps[3]=new step(st_n,"gulB21.gif",0,0,12);
steps[4]=new step(st_n,"gulB22.gif",0,0,12);
steps[5]=new step(st_n,"gulB21.gif",0,0,22);
steps[6]=new step(st_n,"gulB2.gif",0,0,12);
steps[7]=new step(st_n,"gulB22.gif",0,0,22);
steps[8]=new step(st_n,"gulB21.gif",0,0,12);
next_scenarios[0]=new next_scenario("waitupleftB1",10);
next_scenarios[1]=new next_scenario("waitupleftB11",10);
next_scenarios[2]=new next_scenario("upleftB",3);
next_states[0]=new next_state("g0","waitupleftB1",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","upleftB",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","upleftA",2);
}
states[st_n].scenarios["waitupleftB2"]=new scenario;
with(states[st_n].scenarios["waitupleftB2"]){
random_delay=40;
steps[0]=new step(st_n,"gulB4.gif",0,0,12);
steps[1]=new step(st_n,"gulB41.gif",0,0,12);
steps[2]=new step(st_n,"gulB4.gif",0,0,12);
steps[3]=new step(st_n,"gulB41.gif",0,0,12);
steps[4]=new step(st_n,"gulB42.gif",0,0,12);
steps[5]=new step(st_n,"gulB41.gif",0,0,12);
steps[6]=new step(st_n,"gulB42.gif",0,0,12);
steps[7]=new step(st_n,"gulB41.gif",0,0,2);
steps[8]=new step(st_n,"gulB4.gif",0,0,12);
steps[9]=new step(st_n,"gulB42.gif",0,0,122);
steps[10]=new step(st_n,"gulB41.gif",0,0,12);
steps[11]=new step(st_n,"gulB42.gif",0,0,12);
steps[12]=new step(st_n,"gulB41.gif",0,0,2);
next_scenarios[0]=new next_scenario("waitupleftB2",20);
next_scenarios[1]=new next_scenario("upleftB",5);
next_states[0]=new next_state("g0","waitupleftB1",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","upleftB",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","upleftA",2);
}
states[st_n].scenarios["waitupleftB11"]=new scenario;
with(states[st_n].scenarios["waitupleftB11"]){
random_delay=40;
steps[0]=new step(st_n,"gulB1.gif",0,0,12);
steps[1]=new step(st_n,"gulB11.gif",0,0,12);
steps[2]=new step(st_n,"gulB1.gif",0,0,12);
steps[3]=new step(st_n,"gulB11.gif",0,0,12);
steps[4]=new step(st_n,"gulB1.gif",0,0,12);
steps[5]=new step(st_n,"gulB11.gif",0,0,12);
next_scenarios[0]=new next_scenario("waitupleftB1",10);
next_scenarios[1]=new next_scenario("waitupleftB11",20);
next_scenarios[2]=new next_scenario("upleftB",10);
next_states[0]=new next_state("g0","waitupleftB1",99);
onmouseover_zones[0]=new on_zone(0,0,115,115);
onmouseover_zones[0].next_states[0]=new next_state("g0","upleftB",50);
ontouch_next_states["g0"]=new Array;
ontouch_next_states["g0"][0]=new next_state("g0","upleftA",2);
}
states[st_n].scenarios["circle"]=new scenario;
with(states[st_n].scenarios["circle"]){
random_delay=3;
steps[0]=new step(st_n,"gur21.gif",0,-14,2);
steps[1]=new step(st_n,"gur3.gif",19,-37,2);
steps[2]=new step(st_n,"gdr21.gif",14,0,2);
steps[3]=new step(st_n,"gdr3.gif",37,19,2);
steps[4]=new step(st_n,"gdl21.gif",0,14,2);
steps[5]=new step(st_n,"gdl3.gif",-19,37,2);
steps[6]=new step(st_n,"gul21.gif",-14,0,2);
steps[7]=new step(st_n,"gdl3.gif",-37,-19,2);
next_scenarios[0]=new next_scenario("circle",1);
next_scenarios[1]=new next_scenario("upleftA",10);
next_scenarios[2]=new next_scenario("uprightA",10);
next_scenarios[3]=new next_scenario("downleftA",10);
next_scenarios[4]=new next_scenario("downrightA",10);
next_states[0]=new next_state("g0","circle",99);
}
checkStatus("g0","");
}
function boomleft(n){
if(!boom)return;
if(n==null)n=11;
top.resizeBy(n,0);
top.moveBy(-n,0);
n--;n--;
if(n>-11)setTimeout("boomleft("+n+")",2)
}
function boomright(n){
if(!boom)return;
if(n==null)n=11;
top.resizeBy(n,0);
n--;n--;
if(n>-11)setTimeout("boomright("+n+")",2)
}
function boomTop(n){
if(!boom)return;
if(n==null)n=11;
top.resizeBy(0,n);
top.moveBy(0,-n);
n--;n--;
if(n>-11)setTimeout("boomTop("+n+")",2)
}
function boomBottom(n){
if(!boom)return;
if(n==null)n=11;
top.resizeBy(0,n);
n--;n--;
if(n>-11)setTimeout("boomBottom("+n+")",2)
}
var boom=false;
function shake(){
boom=true;
setTimeout("boom=false",5000);
for(t=0;t<10;t++){
top.moveBy(0,10*AMXrnd());
top.moveBy(10*AMXrnd(),0);
top.moveBy(0,-10*AMXrnd());
top.moveBy(-10*AMXrnd(),0);
}
for(t=0;t<AMXq;t++){
cStatus=s[t].status;
cStatus.timeout=0;
cState=cStatus.current_state_name;
cScenario=cStatus.current_scenario_name;
cStatus.step_no=states[cState].scenarios[cScenario].steps.length-1;
}
}
[/spoiler]
[li]untuk js keduanya[/li]
[spoiler]
function sprite(initState,initScenario,x,y,z,minX,minY,maxX,maxY){
this.pos=new pos(x,y,z,minX,minY,maxX,maxY);
this.status=new status(0,initState,initScenario);
}
function pos(x,y,z,minX,minY,maxX,maxY){
this.x=x;
this.y=y;
this.x2=x;
this.y2=y;
this.z=z;
this.maxX=maxX;
this.maxY=maxY;
this.minX=minX;
this.minY=minY;
this.width=0;
this.height=0;
}
function status(
step_no,
current_state_name,
current_scenario_name
){
this.step_no=step_no;
this.current_state_name=current_state_name;
this.current_scenario_name=current_scenario_name;
this.timeout=0;
this.touched=false;
this.touching=new Array;
}
function state(){
this.isReady=false;
this.q_images_to_get=0;
this.z=0;
this.scenarios=new Array;
this.default_ontouch_next_states=new Array;
this.onErrorScenario="";
}
function scenario(){
this.random_delay=0;
this.onclick_zones=new Array;
this.onmouseover_zones=new Array;
this.steps=new Array;
this.next_scenarios=new Array;
this.next_states=new Array;
this.ontop_next_states=new Array;
this.onbottom_next_states=new Array;
this.onleft_next_states=new Array;
this.onright_next_states=new Array;
this.ontouch_next_states=new Array;
}
function on_zone(x,y,dx,dy){
this.x=x;
this.y=y;
this.dx=dx;
this.dy=dy;
this.next_states=new Array;
}
function step(state_name,image,dx,dy,delay){
image=images_basic_path+image;
this.image=image;
this.delay=delay;
this.dx=dx;
this.dy=dy;
if(images_array[image]+""=="undefined"){
states[state_name].q_images_to_get++
images_array[image]=new Image();
images_array[image].onload=success;
images_array[image].onerror=failure;
images_array[image].state_name=state_name;
images_array[image].src=image;
}else{
}
}
function next_scenario(scenario_name,probability){
this.scenario_name=scenario_name;
this.probability=probability;
}
function next_state(state_name,scenario_name,probability){
this.state_name=state_name;
this.scenario_name=scenario_name;
this.probability=probability;
this.action=null;
}
function success(){
states[this.state_name].q_images_to_get--;
}
function failure(){
printToDebug("WARNING: Coudn't get image "+this.src+" for "+this.state_name);
window.defaultStatus="aniMagiX error. Coudn't get image "+this.src;
}
function checkStatus(state_name,action){
if(states[state_name].q_images_to_get<1){
states[state_name].isReady=true;
window.defaultStatus="";
eval(action);
}else{
setTimeout("checkStatus(\""+state_name+"\",\""+action+"\")",1000);
window.defaultStatus="loading aniMagiX images ...";
}
}
function AMXrnd(){
AMXrnd.seed=(AMXrnd.seed*9301+49297)%233280;
return AMXrnd.seed/(233280.0);
}
function AMXmove(sid,sx,sy,sz){
if(isIE){
document.all["AMXb"+sid].style.pixelTop=sy;
document.all["AMXb"+sid].style.pixelLeft=sx;
document.all["AMXb"+sid].style.zIndex=sz;
}else{
if(isNS5){
document.getElementById("AMXb"+sid).style.top=sy;
document.getElementById("AMXb"+sid).style.left=sx;
document.getElementById("AMXb"+sid).style.zIndex=sz;
}else{
document.layers["AMXb"+sid].pageX=sx;
document.layers["AMXb"+sid].pageY=sy;
document.layers["AMXb"+sid].zIndex=sz;
}
}
return;
}
function AMXswap(n,img){
AMXs[n].pos.width=images_array[img].width;
AMXs[n].pos.height=images_array[img].height;
if(isIE||isNS5){
document.images[delta_images+n].src=img;
}else{
if(images_array[img].width!=document.layers["AMXb"+n].document.images[0].width){
document.layers["AMXb"+n].document.open();
document.layers["AMXb"+n].document.write('<A HREF=# onMouseOver="checkOnMouseOver(event,'+n+');return false;" onClick="checkOnClick(event,'+n+');return false;"><img border=0 src="'+img+'"></A>');
document.layers["AMXb"+n].document.close();
}else{
if(images_array[img].height!=document.layers["AMXb"+n].document.images[0].height){
document.layers["AMXb"+n].document.open();
document.layers["AMXb"+n].document.write('<A HREF=# onMouseOver="checkOnMouseOver(event,'+n+');return false;" onClick="checkOnClick(event,'+n+');return false;"><img border=0 src="'+img+'"></A>');
document.layers["AMXb"+n].document.close();
}else{
document.layers["AMXb"+n].document.images[0].src=img;
}
}
}
return;
}
function getRandomSelection(objects){
p=0;
for(i=0;i<objects.length;i++){
p+=objects[i].probability;
}
r=AMXrnd()*p;
p=0;
selected=false;
for(i=0;i<objects.length&&!selected;i++){
p+=objects[i].probability;
if(r<p){
return i;
}
}
return objects.length;
}
function checkPos(sp){
cState=sp.status.current_state_name;
cScenario=sp.status.current_scenario_name;
with(states[cState].scenarios[cScenario]){
with(sp.pos){
found=false;
if(x+width>maxX){
onborder_next_states=onright_next_states;
if(onborder_next_states.length>0)found=true;
}else
if(x<minX){
onborder_next_states=onleft_next_states;
if(onborder_next_states.length>0)found=true;
}
if(y+height>maxY){
if(!found)
onborder_next_states=onbottom_next_states;
else
if(AMXrnd()>win_width/(win_height+win_width)){
onborder2_next_states=onbottom_next_states;
if(onborder2_next_states.length>0)
onborder_next_states=onborder2_next_states;
}else{
}
if(onborder_next_states.length>0)found=true;
}else
if(y<minY){
if(!found)
onborder_next_states=ontop_next_states;
else
if(AMXrnd()>win_width/(win_height+win_width)){
onborder2_next_states=ontop_next_states;
if(onborder2_next_states.length>0)
onborder_next_states=onborder2_next_states;
}else{
}
if(onborder_next_states.length>0)found=true;
}
if(!found)return;
if(changeState(sp,cState,cScenario,onborder_next_states))return;
}}return;
}
function checkTouch(nn){
if(AMXq==0)return;
checkTouchN++;
if(checkTouchN>checkTouchEveryQ){
checkTouchEveryQ=AMXq/4+1;
checkTouchN=0;
if(isIE||isNS5){
for(i=0;i<AMXq;i++){
with(AMXs[i].pos){
x2=x+document.images[delta_images+i].width;
y2=y+document.images[delta_images+i].height;
}
}
}else{
for(i=0;i<AMXq;i++){
with(AMXs[i].pos){
x2=x+document.layers["AMXb"+i].document.images[0].width;
y2=y+document.layers["AMXb"+i].document.images[0].height;
}
}
}
atouched=false;
for(il=0;il<AMXq;il++){
if(!(il==nn)&&(AMXs[il].status.touched==false)){
if(isInBounds(AMXs[il].pos.x,AMXs[il].pos.x2,AMXs[nn].pos.x,AMXs[nn].pos.x2)){
if(isInBounds(AMXs[il].pos.y,AMXs[il].pos.y2,AMXs[nn].pos.y,AMXs[nn].pos.y2)){
if(AMXs[nn].status.touched==false){
if(!atouched)doTouch(nn,il);
doTouch(il,nn);
AMXs[il].status.touched=true;
atouched=true;
}
}
}
}
}
AMXs[nn].status.touched=atouched;
}
return;
}
function doTouch(tt,tt2){
printToDebug(tt+" touched "+tt2);
sp=AMXs[tt];
sp2=AMXs[tt2];
cState=sp.status.current_state_name;
cScenario=sp.status.current_scenario_name;
with(states[cState].scenarios[cScenario]){
states2=ontouch_next_states[sp2.status.current_state_name];
if(states2+""=="undefined"){
states2=states[cState].default_ontouch_next_states[sp2.status.current_state_name];
if(states2+""=="undefined"){
states2=new Array;
}
}
if(changeState(sp,cState,cScenario,states2)){
return;
}else{
}
}
}
function isInBounds(l1,u1,l2,u2){
return(((l1<l2)&&(l2<u1))||((l1<u2)&&(u2<u1)));
}
function changeState(sp,cState,cScenario,next_states_choice){
printToDebug("changeState( "+sp+","+cState+","+cScenario+")");
if(next_states_choice.length==0)return false;
sel=getRandomSelection(next_states_choice);
if(cState==next_states_choice[sel].state_name&&cScenario==next_states_choice[sel].scenario_name){
return false;
}else{
if(!states[next_states_choice[sel].state_name].isReady){
sp.status.current_scenario_name=states[cState].onErrorScenario;
return false;
}
sp.status.current_state_name=next_states_choice[sel].state_name;
sp.status.current_scenario_name=next_states_choice[sel].scenario_name;
sp.pos.z=states[sp.status.current_state_name].z;
sp.status.step_no=0;
eval(next_states_choice[sel].action);
return!(cState==sp.status.current_state_name);
}return;
}
function animate(n){
sp=AMXs[n];
cStatus=sp.status;
cPos=sp.pos;
cState=cStatus.current_state_name;
cScenario=cStatus.current_scenario_name;
if(!(states[cState].isReady)){
printToDebug("state["+cState+"] is not ready");
cStatus.timeout=100;
return;
}
cStatus.step_no++;
with(states[cState].scenarios[cScenario]){
if(cStatus.step_no==steps.length){
cStatus.step_no=0;
if(!changeState(sp,cState,cScenario,next_states)){
sel=getRandomSelection(next_scenarios);
cStatus.current_scenario_name=next_scenarios[sel].scenario_name;
checkTouch(n);
}else{
}
}
}
with(states[cStatus.current_state_name].scenarios[cStatus.current_scenario_name]){
cPos.x=cPos.x+steps[cStatus.step_no].dx;
cPos.y=cPos.y+steps[cStatus.step_no].dy;
checkPos(sp);
AMXmove(n,cPos.x,cPos.y,cPos.z);
}
with(states[cStatus.current_state_name].scenarios[cStatus.current_scenario_name]){
AMXswap(n,steps[cStatus.step_no].image);
if(cStatus.current_scenario_name=="stop"){
AMXmove(n,-1000,0);
cStatus.timeout=-1;
}else{
cStatus.timeout=steps[cStatus.step_no].delay+random_delay*AMXrnd();
}
}
return;
}
var threadLock=false;
function masterThread(){
if(threadLock){
printToDebug("masterThread locked***");
return;
}
threadLock=true;
for(mi=0;mi<AMXq;mi++){
mcTimeout=AMXs[mi].status.timeout;
if(mcTimeout<0){
}else{
if(mcTimeout<1){
animate(mi);
}else{
AMXs[mi].status.timeout=mcTimeout-1;
}
}
}
timeoutCount++;
threadLock=false;
return;
}
function checkOnMouseOver(e,n){
printToDebug("checkOnMouseOver( "+e+","+n+")");
sp=AMXs[n];
cState=sp.status.current_state_name;
cScenario=sp.status.current_scenario_name;
printToDebug(" curren state/scenario: "+cState+","+cScenario+")");
with(states[cState].scenarios[cScenario]){
if(isIE||isNS5){
xDelta=document.body.scrollLeft+window.event.x-sp.pos.x;
yDelta=document.body.scrollTop+window.event.y-sp.pos.y;
}else{
xDelta=e.layerX;
yDelta=e.layerY;
}
if(onmouseover_zones.length==0){
return
}else{
for(i=0;i<onmouseover_zones.length;i++){
with(onmouseover_zones[i]){
printToDebug("change? x,y:"+x+","+y+" xDelta,yDelta: "+xDelta+","+yDelta+" dx,dy : "+dx+","+dy);
if((xDelta>x)&&(yDelta>y)&&(xDelta-x<dx)&&(yDelta-y<dy)){
printToDebug("yes");
changeState(sp,cState,cScenario,next_states)
sp.status.step_no=-1;
sp.status.timeout=0;
return;
}
}
}
}
}
}
function checkOnClick(e,n){
printToDebug("checkOnClick( "+e+","+n+")");
sp=AMXs[n];
cState=sp.status.current_state_name;
cScenario=sp.status.current_scenario_name;
with(states[cState].scenarios[cScenario]){
if(isIE||isNS5){
xDelta=document.body.scrollLeft+window.event.x-sp.pos.x;
yDelta=document.body.scrollTop+window.event.y-sp.pos.y;
}else{
xDelta=e.layerX;
yDelta=e.layerY;
}
if(onclick_zones.length==0){
return
}else{
for(i=0;i<onclick_zones.length;i++){
with(onclick_zones[i]){
printToDebug("change? x,y:"+x+","+y+" xDelta,yDelta: "+xDelta+","+yDelta+" dx,dy : "+dx+","+dy);
if((xDelta>x)&&(yDelta>y)&&(xDelta-x<dx)&&(yDelta-y<dy)){
printToDebug("yes");
if(changeState(sp,cState,cScenario,next_states))
sp.status.step_no=-1;
sp.status.timeout=0;
return;
}
}
}
}
}
}
function AMXspritesHTML(){
AMXspritesHTML=""
container="span";
for(i=0;i<AMXq;i++){
if(isIE||isNS5)
clickCode1=' onClick="checkOnClick(0,'+i+')"'+' onMouseOver="checkOnMouseOver(0,'+i+')"';
else
clickCode1="";
AMXspritesHTML=AMXspritesHTML+'<'+container+' id="AMXb'+i+'"'+clickCode1+' class="asf"><img src=""></'+container+'>\n';
}
return AMXspritesHTML;
}
function initAnims(){
initStates();
if(isIE){
win_height=document.body.clientHeight;
win_width=document.body.clientWidth;
body_height=document.body.scrollHeight;
body_width=win_width;
}else{
win_height=window.innerHeight;
win_width=window.innerWidth-20;
body_height=window.innerHeight;
body_width=win_width;
}
setSpriteObjects();
setTimeout("animStarted = true;",1000);
if(isIE)
oInterval=setInterval(launchMasterThread,interval);
else
oInterval=setInterval(masterThread,interval);
}
function launchMasterThread(){
if(speedUp){
testSlowBack--;
if(testSlowBack>0){
masterThread();
setTimeout(masterThread,interval);
}else{
testSlowBack=50;
AMXt0=new Date();
AMXn1=AMXt0.getSeconds()*1000+AMXt0.getMilliseconds();
masterThread();
AMXt0=new Date();
AMXn2=AMXt0.getSeconds()*1000+AMXt0.getMilliseconds();
if(AMXn1>AMXn2)return;
if((AMXn2-AMXn1)!=0&&(AMXn2-AMXn1)<interval*2){
printToDebug("****SPEED DOWN**** "+(AMXn2-AMXn1));
window.clearInterval(oInterval);
speedUp=false;
interval=interval*2;
oInterval=setInterval(launchMasterThread,interval);
interval=interval*2;
}
}
}else{
AMXt0=new Date();
AMXn1=AMXt0.getSeconds()*1000+AMXt0.getMilliseconds();
masterThread();
AMXt0=new Date();
AMXn2=AMXt0.getSeconds()*1000+AMXt0.getMilliseconds();
if(AMXn1>AMXn2)return;
if((AMXn2-AMXn1)>interval*5){
wasTooSlow++;
printToDebug("animation too slow");
if(wasTooSlow>2){
printToDebug("****SPEED UP**** ");
wasTooSlow=0;
window.clearInterval(oInterval);
speedUp=true;
interval=interval/2;
oInterval=setInterval(launchMasterThread,interval);
interval=interval/2;
}
}
}
}
function resizeFix(){
if(!animStarted)return;
document.location.href=document.location.href;
}
function printToDebug(m){
if(!debugAMX)return;
window.defaultStatus="DEBUG "+":"+m;
debugLinesCursor++;
debugCount++;
if(!(debugLinesCursor<debugLinesMax))debugLinesCursor=0;
debugLines[debugLinesCursor]=debugCount+": "+m;
debugString="<font size=-2 face=arial>";
for(i=debugLinesCursor+1;i<debugLinesMax;i++){
debugString+=debugLines[i]+"<br>";
}
for(i=0;i<debugLinesCursor+1;i++){
debugString+=debugLines[i]+"<br>";
}
debugString+="</font>";
if(isIE)
document.all.debugConsole.innerHTML=debugString;
else{
if(isNS5){
document.getElementById('debugConsole').innerHTML=debugString;
}else{
document.layers.debugConsole.document.open();
document.layers.debugConsole.document.write(debugString);
document.layers.debugConsole.document.close();
}
}
}
var is_major=parseInt(navigator.appVersion);
if(is_major>=4){
var win_height;
var win_width;
var images_array=new Array;
var AMXs=new Array;
var checkTouchEveryQ=0;
var checkTouchN=0;
var noStatusChange=false;
var animStarted=false;
var timeoutCount=0;
var oInterval;
var interval=10;
var speedUp=false;
var testSlowBack=10;
var wasTooSlow=0;
AMXrnd.today=new Date();
AMXrnd.seed=AMXrnd.today.getTime();
var isIE=(document.all);
var isNS5=(document.getElementById);
var delta_images=document.images.length;
document.writeln(AMXspritesHTML());
if(debugAMX){
var debugLinesMax=10;
var debugLines=new Array;
var debugCount=0;
document.writeln('<span id="debugConsole" class="asd">test</span>');
for(i=0;i<debugLinesMax;i++){
debugLines[i]=""
}
var debugLinesCursor=0;
}
window.onload=initAnims;
if(!isIE)window.onResize=resizeFix;
}
[/spoiler][/quote]