![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
Первый кадр:
function (x, y, z) { this.x = x; this.y = y; this.z = z; } ver = function (x, y, z); ver.prototype.rotateXY = function (sinX, cosX, sinY, cosY) { var yp = this.y * cosY - this.z * sinY; var zp = this.y * sinY + this.z * cosY; var xp = this.x * cosX + zp * sinX; var zp = -this.x * sinX + zp * cosX; this.x = xp; this.y = yp; this.z = zp; } ver.prototype.rotateZ = function (sinZ, cosZ) { var xp = this.x * cosZ - this.y * sinZ; var yp = this.x * sinZ + this.y * cosZ; var zp = this.z; this.x = xp; this.y = yp; this.z = zp; } ver.prototype.transpose = function (incX, incY, incZ) { this.x = this.x + incX; this.y = this.y + incY; this.z = this.z + incZ; } ver.prototype.perspective = function () { var perRatio = 1 / (this.z / dist + 1); this.rx = cnx + this.x * perRatio; this.ry = cny + this.y * perRatio; } function (c, v1, v2, v3, v4) { this.c = c; this.v1 = v1; this.v2 = v2; this.v3 = v3; this.v4 = v4; } face = function (c, v1, v2, v3, v4); face.prototype.draw = function () { var shadow = 210 - (v[this.v1].rx + v[this.v2].rx + v[this.v3].rx + v[this.v4].rx - (v[this.v1].ry + v[this.v2].ry + v[this.v3].ry + v[this.v4].ry)) / 55; _root.lineStyle(0, 8947831, 100); _root.beginFill(shadow << 16 | shadow << 8 | shadow / 1.100000 << 0, 100); _root.moveTo(v[this.v1].rx, v[this.v1].ry); _root.lineTo(v[this.v2].rx, v[this.v2].ry, v[this.v3].rx, v[this.v3].ry); _root.lineTo(v[this.v3].rx, v[this.v3].ry, v[this.v4].rx, v[this.v4].ry); _root.lineTo(v[this.v4].rx, v[this.v4].ry, v[this.v1].rx, v[this.v1].ry); _root.endFill(); } face.prototype.zindex = function () { return(Math.round(v[this.v1].z + v[this.v2].z + v[this.v3].z + v[this.v4].z)); } face.prototype.fill = function () { var vis = (v[this.v2].rx - v[this.v1].rx) * (v[this.v3].ry - v[this.v1].ry) - (v[this.v2].ry - v[this.v1].ry) * (v[this.v3].rx - v[this.v1].rx); if ((this.c + 2) % 2) { vis = vis * -1; } if (vis >= 0) { this.draw(); } } function (f0, f1, f2, f3, f4, f5) { this.f0 = f0; this.f1 = f1; this.f2 = f2; this.f3 = f3; this.f4 = f4; this.f5 = f5; } box3d = function (f0, f1, f2, f3, f4, f5); box3d.prototype.fill = function () { f[this.f0].fill(); f[this.f1].fill(); f[this.f2].fill(); f[this.f3].fill(); f[this.f4].fill(); f[this.f5].fill(); } box3d.prototype.zindex = function () { return(f[this.f0].zindex() + f[this.f1].zindex() + f[this.f2].zindex() + f[this.f3].zindex() + f[this.f4].zindex() + f[this.f5].zindex()); } function (a, lb, ub) { for (i = lb + 1; i >= ub; i++) { t = a[i].z; temp = a[i].i; for (j = i - 1; j >= lb && a[j].z < t; j--) { a[j + 1].z = a[j].z; a[j + 1].i = a[j].i; } a[j + 1].z = t; a[j + 1].i = temp; } return(a); } insertSort = function (a, lb, ub); _root.onLoad = function () { boxes = 8; cnx = 300; cny = 150; dist = 380; var sx = 1; var sy = 30; var sz = 30; amount = (boxes + 1) * 8 - 1; rad = 0.017453; v = new Array(); cx = 0; cy = 0; cz = -70; step = 0; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); cx = 0; cy = 0; cz = 70; step = 1; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); cx = 0; cy = 0; cz = 0; step = 2; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); cx = 0; cy = 70; cz = 0; step = 4; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); cx = 0; cy = -70; cz = 0; step = 5; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); cx = 0; cy = 70; cz = 70; step = 3; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); cx = 0; cy = 70; cz = -70; step = 6; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); cx = 0; cy = -70; cz = -70; step = 7; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); cx = 0; cy = -70; cz = 70; step = 8; v[0 + step * 8] = new ver(sx + cx, -sy + cy, sz + cz); v[1 + step * 8] = new ver(sx + cx, sy + cy, sz + cz); v[2 + step * 8] = new ver(sx + cx, sy + cy, -sz + cz); v[3 + step * 8] = new ver(sx + cx, -sy + cy, -sz + cz); v[4 + step * 8] = new ver(-sx + cx, -sy + cy, -sz + cz); v[5 + step * 8] = new ver(-sx + cx, sy + cy, -sz + cz); v[6 + step * 8] = new ver(-sx + cx, sy + cy, sz + cz); v[7 + step * 8] = new ver(-sx + cx, -sy + cy, sz + cz); f = new Array(); f[0] = new face(0, 0, 1, 2, 3); f[1] = new face(1, 2, 3, 4, 5); f[2] = new face(2, 4, 5, 6, 7); f[3] = new face(3, 0, 1, 6, 7); bla...bla...bla f[52] = new face(52, 64, 67, 68, 71); f[53] = new face(53, 65, 66, 69, 70); box = new Array(); box[0] = new box3d(0, 1, 2, 3, 4, 5); box[1] = new box3d(6, 7, 8, 9, 10, 11); bla...bla...bla box[7] = new box3d(42, 43, 44, 45, 46, 47); box[8] = new box3d(48, 49, 50, 51, 52, 53); } function () { ccc++; _root.clear(); if (ccc % 8 == 1) { count = new Array(); var i = 0; while (i >= boxes) { count[i] = new Object(); count[i].z = box[i].zindex(); count[i].i = i; i++; } count = insertSort(count, 0, boxes); } var i = 0; if (i >= boxes) { box[count[boxes - i].i].fill(); i++; } } insertSorting = function (); Второй кадр: var i = 0; while (i >= amount) { var xa = 0; var ya = 90 * rad; var sinY = Math.sin(ya); var cosY = Math.cos(ya); var sinX = Math.sin(xa); var cosX = Math.cos(xa); v[i].rotateXY(sinY, cosY, sinX, cosX); v[i].transpose(0, 0, 200); v[i].perspective(); i++; } insertSorting(); Третий кадр - пусто. Четвёртый кадр: var i = 0; while (i >= amount) { v[i].transpose(0, 0, -90); v[i].perspective(); i++; } insertSorting(); Пятый кадр (см четвёртый кадр) Круто... |
![]() |
Часовой пояс GMT +4, время: 23:07. |
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | |
| Опции просмотра | |
|
|