3年以上前に作ったもの。なんとなくそれっぽい面の明るさや陰面消去をやり始めた頃。
今見ると内部の計算の仕方がかなり半端だけど、出来上がった絵柄自体は気に入っている。
AS3版に作り直そうとしたけど、半端な実装がかえっていい味なので、挫折。
AS3版を作ろうとしたら結局、先日のQbicQubeになった。
▼ActionScript AS1(FP6):ステージサイズ800*600でタイムラインの1フレーム目に書く。
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
Stage.scaleMode = "noScale"; vp = 500; ar_data = new Array([0, 0, 0], [160, 0, 0], [100, 0, 0]); ar_rxyz = new Array(0, 1, 2, 3, 4, 5); ar_n = new Array([1, 1, 1], [-1, 1, 1], [-1, -1, 1], [1, -1, 1], [1, 1, -1], [-1, 1, -1], [-1, -1, -1], [1, -1, -1]); ar_m = new Array([1, 1, 1], [1, -1, -1], [-1, -1, 1], [-1, 1, -1], [-1, -1, 1], [-1, 1, -1], [1, 1, 1], [1, -1, -1]); function fc_render() { ar_position = new Array([0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]); n = new Number(); n = Math.sqrt(ar_data[2][0]*ar_data[2][0]+ar_data[2][1]*ar_data[2][1]+ar_data[2][2]*ar_data[2][2]); if (n == 0) { n = 0.1; } m = new Number(); m = Math.sqrt(ar_data[1][0]*ar_data[1][0]+ar_data[1][1]*ar_data[1][1]+ar_data[1][2]*ar_data[1][2]); if (m == 0) { m = 0.1; } for (var j = 0; j<8; j++) { ar_rxyz[0] = m*ar_n[j][0]; ar_rxyz[1] = m*ar_n[j][1]; ar_rxyz[2] = m*ar_n[j][2]; ar_rxyz[3] = rotate_x1; ar_rxyz[4] = rotate_y1; ar_rxyz[5] = rotate_z1; fc_remap(ar_rxyz[0], ar_rxyz[1], ar_rxyz[2], ar_rxyz[3], ar_rxyz[4], ar_rxyz[5]); var n_remapx = ar_remap[0]; var n_remapy = ar_remap[1]; var n_remapz = ar_remap[2]; for (var i = 0; i<8; i++) { k = j*8+i; ar_rxyz[0] = n*ar_n[i][0]; ar_rxyz[1] = n*ar_n[i][1]; ar_rxyz[2] = n*ar_n[i][2]; ar_rxyz[3] = rotate_x2*ar_m[j][0]; //+rotate_x1; ar_rxyz[4] = rotate_y2*ar_m[j][1]; //+rotate_y1; ar_rxyz[5] = rotate_z2*ar_m[j][2]; //+rotate_z1; fc_remap(ar_rxyz[0], ar_rxyz[1], ar_rxyz[2], ar_rxyz[3], ar_rxyz[4], ar_rxyz[5]); ar_position[k][0] = ar_data[0][0]+n_remapx+ar_remap[0]; ar_position[k][1] = ar_data[0][1]+n_remapy+ar_remap[1]; ar_position[k][2] = ar_data[0][2]+n_remapz+ar_remap[2]; } } for (var i = 0; i<ar_position.length; i++) { fc_pertrans(ar_position[i][0], ar_position[i][1], ar_position[i][2]); ar_position[i][0] = ar_pertrans[0]; ar_position[i][1] = ar_pertrans[1]; ar_position[i][2] = ar_pertrans[2]; } ar_sq = new Array(); for (var j = 0; j<8; j++) { for (var i = 0; i<6; i++) { var k = j*8; var kk = j*6; var n_xx = (ar_position[ar_sqd[i][0]+k][0]+ar_position[ar_sqd[i][1]+k][0]+ar_position[ar_sqd[i][2]+k][0]+ar_position[ar_sqd[i][3]+k][0])/4; var n_yy = (ar_position[ar_sqd[i][0]+k][1]+ar_position[ar_sqd[i][1]+k][1]+ar_position[ar_sqd[i][2]+k][1]+ar_position[ar_sqd[i][3]+k][1])/4; var n_zz = (ar_position[ar_sqd[i][0]+k][2]+ar_position[ar_sqd[i][1]+k][2]+ar_position[ar_sqd[i][2]+k][2]+ar_position[ar_sqd[i][3]+k][2])/4; var n_xxyyzz = Math.sqrt(n_xx*n_xx+n_yy*n_yy+(vp*5-n_zz)*(vp*5-n_zz)); n_xxyyzz = 10000000-n_xxyyzz*1000; var n_cx = (ar_position[ar_sqd[i][0]+k][1]-ar_position[ar_sqd[i][3]+k][1])*(ar_position[ar_sqd[i][1]+k][2]-ar_position[ar_sqd[i][0]+k][2])-(ar_position[ar_sqd[i][0]+k][2]-ar_position[ar_sqd[i][3]+k][2])*(ar_position[ar_sqd[i][1]+k][1]-ar_position[ar_sqd[i][0]+k][1]); var n_cy = (ar_position[ar_sqd[i][0]+k][2]-ar_position[ar_sqd[i][3]+k][2])*(ar_position[ar_sqd[i][1]+k][0]-ar_position[ar_sqd[i][0]+k][0])-(ar_position[ar_sqd[i][0]+k][0]-ar_position[ar_sqd[i][3]+k][0])*(ar_position[ar_sqd[i][1]+k][2]-ar_position[ar_sqd[i][0]+k][2]); var n_cz = (ar_position[ar_sqd[i][0]+k][0]-ar_position[ar_sqd[i][3]+k][0])*(ar_position[ar_sqd[i][1]+k][1]-ar_position[ar_sqd[i][0]+k][1])-(ar_position[ar_sqd[i][0]+k][1]-ar_position[ar_sqd[i][3]+k][1])*(ar_position[ar_sqd[i][1]+k][0]-ar_position[ar_sqd[i][0]+k][0]); n_c = Math.acos(n_cy/Math.sqrt(n_cx*n_cx+n_cy*n_cy+n_cz*n_cz))/Math.PI; n_c = Math.round(Math.abs(n_c-0.5)*500); n_c = n_c*256*256+n_c*256+n_c; ar_sqmini[i] = [ar_position[ar_sqd[i][0]+k], ar_position[ar_sqd[i][1]+k], ar_position[ar_sqd[i][2]+k], ar_position[ar_sqd[i][3]+k], n_xxyyzz, n_c]; } ar_sqmini.sortOn([4]); ar_sqmini.shift(); ar_sqmini.shift(); ar_sqmini.shift(); ar_sq = ar_sq.concat(ar_sqmini); } ar_sq.sortOn([4]); ar_sq.reverse(); for (var k = 0; k<24; k++) { this.createEmptyMovieClip("sq_mc"+k, 100-k); str = eval("sq_mc"+k); with (str) { beginFill(ar_sq[k][5], 100); moveTo(ar_sq[k][3][0]+400, ar_sq[k][3][1]+300); for (var ii = 0; ii<4; ii++) { lineTo(ar_sq[k][ii][0]+400, ar_sq[k][ii][1]+300); } endFill(); } } } rotate_x1 = 0; rotate_x2 = 0; rotate_tox1 = 0; rotate_tox2 = 0; rotate_y1 = 0; rotate_y2 = 0; rotate_toy1 = 0; rotate_toy2 = 0; rotate_z1 = 0; rotate_z2 = 0; rotate_toz1 = 0; rotate_toz2 = 0; function fc_animator() { if (Math.abs(_root._xmouse-400)>Math.abs(_root._ymouse-300)) { rotate_y1 += (_root._xmouse-400)/5000; rotate_y2 += (_root._xmouse-400)/5000; } else if (Math.abs(_root._xmouse-400)<Math.abs(_root._ymouse-300)) { rotate_x1 += (_root._ymouse-300)/5000; rotate_x2 += (_root._ymouse-300)/5000; } fc_render(); } ar_sqmini = new Array([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0]]); ar_sq = new Array(); ar_sqd = new Array([0, 1, 2, 3], [4, 5, 6, 7], [0, 1, 5, 4], [2, 3, 7, 6], [1, 2, 6, 5], [0, 3, 7, 4]); var interval = setInterval(fc_animator, 30); //// ar_remap = new Array(); function fc_remap(x, y, z, rx, ry, rz) { n_cx = Math.cos(rx); n_sx = Math.sin(rx); n_cy = Math.cos(ry); n_sy = Math.sin(ry); n_cz = Math.cos(rz); n_sz = Math.sin(rz); n_x = x*(n_cz*n_cy+n_sy*n_sx*n_sz)+y*(-n_sz*n_cy+n_sy*n_sx*n_cz)+z*(n_sy*n_cx)+n_dx; n_y = x*(n_cx*n_sz)+y*n_cx*n_cz-z*(n_sx)+n_dy; n_z = x*(-n_sy*n_cz+n_cy*n_sx*n_sz)+y*(n_sy*n_sz+n_cy*n_sx*n_cz)+z*(n_cy*n_cx)+n_dz; ar_remap = [n_x, n_y, n_z]; return ar_remap; } ar_pertrans = new Array(); function fc_pertrans(x, y, z) { if (vp+z != 0) { per = vp/(vp+z); } x = x*per; y = y*per; scale = per*100; ar_pertrans = [x, y, scale]; return ar_pertrans; } stop(); |