Forum de discussion
Forum « Flash et Shockwave » (archives)
A L'aide!!!!
Envoyé: 1er mai 2005, 12h24 par memoriam
Si vous avez du temps pour m'aider, n'hésitez pas!
voila le code :
walls = new array();
rad = Math.PI/180;
// number of items
max = 10;
// width of items
width = 40;
rat = width/100;
radius = (width*max)/Math.PI;
astep = -360/max;
dist = radius*2+50;
for (i=0; i<max; i++) {
walls[i] = new Object();
walls[i].y = 0;
walls[i].x1 = Math.sin(astep*i*rad)*radius+Math.sin((astep*i+90)*rad)*width/2;
walls[i].z1 = Math.cos(astep*i*rad)*radius+Math.cos((astep*i+90)*rad)*width/2;
walls[i].x2 = Math.sin(astep*i*rad)*radius+Math.sin((astep*i-90)*rad)*width/2;
walls[i].z2 = Math.cos(astep*i*rad)*radius+Math.cos((astep*i-90)*rad)*width/2;
}
//
function clicked (n) {
_root.menu._xscale = _root.menu._yscale=20;
_root.menu._x = 50;
_root.menu._y = 200;
_root.menu.gotoAndStop(2);
_root.name_section = "section::" add n
}
function menuback () {
_root.menu._xscale = _root.menu._yscale=100;
_root.menu._x = 160;
_root.menu._y = 120;
_root.menu.gotoAndStop(1);
_root.name_section = "main"
}
//
function Redraw (ya) {
xa = 0;
var cosYangle = Math.cos(ya*rad);
var sinYangle = Math.sin(ya*rad);
var cosXangle = Math.cos(xa*rad);
var sinXangle = Math.sin(xa*rad);
// rotation
for (i=0; i<max; i++) {
x = walls[i].x1;
z = walls[i].z1;
y = walls[i].y1;
var tempz = (z*cosYangle)-(x*sinYangle);
var tx = (z*sinYangle)+(x*cosYangle);
var tz = (y*sinXangle)+(tempz*cosXangle);
var ty = (y*cosXangle)-(tempz*sinXangle);
var zratio = dist/(tz+dist);
walls[i].sx1 = +tx*zratio;
walls[i].sy1 = -ty*zratio;
walls[i].size1 = 50*zratio;
x = walls[i].x2;
z = walls[i].z2;
y = walls[i].y2;
var tempz = (z*cosYangle)-(x*sinYangle);
var tx = (z*sinYangle)+(x*cosYangle);
var tz = (y*sinXangle)+(tempz*cosXangle);
var ty = (y*cosXangle)-(tempz*sinXangle);
var zratio = dist/(tz+dist);
walls[i].sx2 = +tx*zratio;
walls[i].sy2 = -ty*zratio;
walls[i].size2 = 50*zratio;
}
// visualisation
for (i=0; i<max; i++) {
name = "sh" add i;
_root.menu.ins.attachMovie("shape", name, i+1);
_root.menu.ins[name].pic.gotoAndStop(i%6);
_root.menu.ins[name].pic.name = i;
_root.menu.ins[name].n = i;
if (walls[i].size1<walls[i].size2) {
ratio = int((walls[i].size1/walls[i].size2)*1000);
_root.menu.ins[name]._x = walls[i].sx2/(r+1);
_root.menu.ins[name]._y = -walls[i].sy2/(r+1);
_root.menu.ins[name]._yscale = walls[i].size2/(r+1);
_root.menu.ins[name]._xscale = (walls[i].sx1-walls[i].sx2)/(r+1);
_root.menu.ins[name].pic._xscale = -100;
} else {
ratio = int((walls[i].size2/walls[i].size1)*1000);
_root.menu.ins[name]._x = walls[i].sx1/(r+1);
_root.menu.ins[name]._y = -walls[i].sy1/(r+1);
_root.menu.ins[name]._yscale = walls[i].size1/(r+1);
_root.menu.ins[name]._xscale = (walls[i].sx2-walls[i].sx1)/(r+1);
}
_root.menu.ins[name]._alpha = 40;
_root.menu.ins[name].gotoAndStop(1000-ratio);
}
}
stop ();
Le fichier est téléchargeable ici si vous êtes inscrit ( gratuit ):
sur ultrashock.com
Ultrashock FLA's > Navigation & Interface > Rotating Menu
Merci beaucoup!! j'attends vos réponses!!!
Réponses
|