1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| count = 0;
while (count < VerticeNum) {
count ++;
this["z" add count] = Math.cos((count*45) * (math.PI/180)) * 50;
this["y" add count] = Math.sin((count*45) * (math.PI/180)) * 50;
this["x" add count] = (count * 40) - (VerticeNum/2 * 40);
duplicateMovieClip("Vertex", "Vertex" add count, count );
}
duplicateMovieClip("Line", "Vertex10", 100);
setProperty("Vertex", _visible, 0);
setProperty("Line", _visible, 0);
CenterRotationX = 0;
CenterRotationY = 0;
TrailerX = 50;
TrailerY = 360;
// 3d (calculs);
function calc3d() {
c = 0;
while (c < VerticeNum + 1) {
c++;
Xang = Xangle * (math.PI/180);
Yang = Yangle * (math.PI/180);
// -----------------------------------------
// --- rotation y ---
// -----------------------------------------
this["zpos" + c] = this["z" + c] * math.cos(Yang) - this["x" + c] * math.sin(Yang);
this["xpos" + c] = this["z" + c] * math.sin(Yang) + this["x" + c] * math.cos(Yang);
// -----------------------------------------
// --- rotation x ---
// -----------------------------------------
this["ypos" + c] = this["y" + c] * math.cos(Xang) - this["zpos" + c] * math.sin(Xang);
this["zpos" + c] = this["y" + c] * math.sin(Xang) + this["zpos" + c] * math.cos(Xang);
// -----------------------------------------
// -- de la 3d à la 2d --
// -----------------------------------------
this["Depth" + c] = (1 / ((this["zpos" + c]/perspective) + 1));
// -----------------------------------------
// --- dessin---
// -----------------------------------------
this["Vertex" + c]._x = this["xpos" + c] * this["Depth" + c] + CenterRotationX;
this["Vertex" + c]._y = this["ypos" + c] * this["Depth" + c] + CenterRotationY;
this["Vertex" + c]._xscale = this["Vertex" + c]._yscale = (this["Depth" + c] / 2) * 500 ;
// -----------------------------------------
// --- Sorting ---
// -----------------------------------------
this["Vertex" + c].swapDepths(this["Depth" + c] * 500);
}
}
// configuration de l'angle;
function setAngle() {
TrailerY = TrailerY + (NewPosY - TrailerY)/5;
Xangle = TrailerY;
} |
Partager