PDA

Просмотр полной версии : ActionScripts.TXT Смотрите <-- здесь мои Flash MX исходники


nuran
14.06.2003, 08:25
// 3D CUBE
vertex = function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
vertex.prototype.rotateXY = function(sinX, cosX, sinY, cosY) {
//rotation around of axes X and Y
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;
};
vertex.prototype.perspective = function() {
//calculation 3d to 2d
var perRatio = 1/(this.z/dist+1);
this.rx = cnx+this.x*perRatio;
this.ry = cny+this.y*perRatio;
};
face = function (c, v1, v2, v3, v4) {
this.c = c;
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
};
face.prototype.draw = function() {
var shadow = 140+((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))/4;
_root.lineStyle(0, 0x000000, 100);
_root.beginFill(shadow << 16 | shadow << 8 | shadow << 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.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 *= -1;
}
if (vis>=0) {
this.draw();
}
};
_root.onLoad = function() {
cnx = 250;
cny = 250;
dist = 200;
var sx = 75;
var sy = 75;
var sz = 75;
rad = Math.PI/180;
amount = 7;
// initialization of the vertex
v = new Array();
v[0] = new vertex(sx, -sy, sz);
v[1] = new vertex(sx, sy, sz);
v[2] = new vertex(sx, sy, -sz);
v[3] = new vertex(sx, -sy, -sz);
v[4] = new vertex(-sx, -sy, -sz);
v[5] = new vertex(-sx, sy, -sz);
v[6] = new vertex(-sx, sy, sz);
v[7] = new vertex(-sx, -sy, sz);
// initialization of the faces
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);
f[4] = new face(4, 0, 3, 4, 7);
f[5] = new face(5, 1, 2, 5, 6);
};
// ####################################################
// -- © 2002-2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// ####################################################
this.onEnterFrame = function() {
var xa = -(cnx-_ymouse)*rad/25;
var ya = (cny-_xmouse)*rad/25;
var sinY = Math.sin(ya);
var cosY = Math.cos(ya);
var sinX = Math.sin(xa);
var cosX = Math.cos(xa);
for (var i = 0; i<=amount; i++) {
v[i].rotateXY(sinY, cosY, sinX, cosX);
v[i].perspective();
}
_root.clear();
// fill the right side face
f[0].fill();
// fill the front face
f[1].fill();
// fill the left side face
f[2].fill();
// fill the back face
f[3].fill();
// fill the bottoms face
f[4].fill();
// fill the top face
f[5].fill();
};
stop();

------------------------------------------------------------------------------------

// 3D Splines Like

initialization = function () {
cnx = 250;
cny = 250;
mas = new Array(0, 0.5, 0, -0.5, 1, 1.23, 1, 1, 1.23, 1);
radius = 120;
spline = 10;
amount = spline*3;
rad = Math.PI/180;
i = 0;
v = new Array();
for (var next = 0; next<=3; next++) {
var am = amount*next/3;
do {
var angle = (i*Math.PI*6)/amount;
v[i] = new ver(Math.cos(angle)*radius*mas[next+3], Math.sin(angle)*radius*mas[next+6], radius*mas[next]);
} while (i++<am);
}
dist = radius*((mas[5]+mas[8])*0.5)*2.5;
};
ver = function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
ver.prototype.rotate3d = function(ya, xa) {
var zp = (this.z*Math.cos(ya*rad))-(this.x*Math.sin(ya*rad));
var xp = (this.z*Math.sin(ya*rad))+(this.x*Math.cos(ya*rad));
var yp = (this.y*Math.cos(xa*rad))-(zp*Math.sin(xa*rad));
var zp = (this.y*Math.sin(xa*rad))+(zp*Math.cos(xa*rad));
this.x = xp;
this.y = yp;
this.z = zp;
};
ver.prototype.perspective = function() {
var perRatio = 1/(this.z/dist+1);
this.rx = cnx+this.x*perRatio;
this.ry = cny+this.y*perRatio;
};
curveThree = function (x1, y1, x2, y2, x3, y3) {
var nx = 2*x2-0.5*(x1+x3);
var ny = 2*y2-0.5*(y1+y3);
this.moveTo(x1, y1);
this.curveTo(nx, ny, x3, y3);
};
splines = function () {
var df = amount/3;
clear();
lineStyle(16, 0xFFFFFF, 100);
for (var i = 1; i<=df; i++) {
curveThree(v[i].rx, v[i].ry, v[i+df].rx, v[i+df].ry, v[i+df*2].rx, v[i+df*2].ry);
}
lineStyle(14, 0x000000, 100);
for (var i = 1; i<=df; i++) {
curveThree(v[i].rx, v[i].ry, v[i+df].rx, v[i+df].ry, v[i+df*2].rx, v[i+df*2].ry);
}
};
// ##################################################################
// -- 3D SPLINES LIKE v2.0
// -- © 2002-2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// -- original idea - Den Ivanov | CleoAG.com
// ##################################################################
initialization();
this.onEnterFrame = function () {
for (var i = 0; i<=amount; i++) {
v[i].rotate3d(-(cnx-_xmouse)*0.05, (cny-_ymouse)*0.05);
v[i].perspective();
}
splines();
};
stop();

nuran
14.06.2003, 08:27
------------------------------------------------------------------------------------

// 3D Boxes Engine

insertSort = 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);
};
ver = function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
ver.prototype.rotateXY = function(sinX, cosX, sinY, cosY) {
//rotation around of axes X and Y
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.perspective = function() {
//calculation 3d to 2d
var perRatio = 1/(this.z/dist+1);
this.rx = cnx+this.x*perRatio;
this.ry = cny+this.y*perRatio;
};
face = function (c, v1, v2, v3, v4) {
this.c = c;
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
};
face.prototype.draw = function() {
var shadow = 140+((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;
//var shadow = 255;
_root.lineStyle(0, 0x000000, 100);
_root.beginFill(shadow << 16 | shadow << 8 | shadow << 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 *= -1;
}
if (vis>=0) {
this.draw();
}
};
box3d = 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.prototype.fill = function() {
// fill the right side face
f[this.f0].fill();
// fill the front face
f[this.f1].fill();
// fill the left side face
f[this.f2].fill();
// fill the back face
f[this.f3].fill();
// fill the bottoms face
f[this.f4].fill();
// fill the top face
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());
};
_root.onLoad = function() {
cnx = 250;
cny = 250;
dist = 500;
boxes = 13;
amount = 111;
rad = Math.PI/180;
v = new Array();
f = new Array();
box = new Array();
// center_X, center Y, center Z, size_X, size_Y, size_Z
box0 = [0, 0, 0, 50, 50, 10];
box1 = [-110, 0, 0, 50, 50, 10];
box2 = [110, 0, 0, 50, 50, 10];
box3 = [-110, 110, 0, 50, 50, 10];
box4 = [110, 110, 0, 50, 50, 10];
box5 = [-110, -110, 0, 50, 50, 10];
box6 = [110, -110, 0, 50, 50, 10];
box7 = [-110, 110, 110, 50, 50, 10];
box8 = [110, 110, 110, 50, 50, 10];
box9 = [0, 0, -110, 50, 50, 10];
box10 = [0, 110, 0, 50, 50, 10];
box11 = [-110, -110, 110, 50, 50, 10];
box12 = [110, -110, 110, 50, 50, 10];
box13 = [0, -110, 0, 50, 50, 10];
//
for (var i = 0; i<=boxes; i++) {
var c = i*8;
var c1 = i*6;
var cx = eval("box"+i)[0];
var cy = eval("box"+i)[1];
var cz = eval("box"+i)[2];
var sx = eval("box"+i)[3];
var sy = eval("box"+i)[4];
var sz = eval("box"+i)[5];
// initialization of the vertex
v[0+c] = new ver(sx+cx, -sy+cy, sz+cz);
v[1+c] = new ver(sx+cx, sy+cy, sz+cz);
v[2+c] = new ver(sx+cx, sy+cy, -sz+cz);
v[3+c] = new ver(sx+cx, -sy+cy, -sz+cz);
v[4+c] = new ver(-sx+cx, -sy+cy, -sz+cz);
v[5+c] = new ver(-sx+cx, sy+cy, -sz+cz);
v[6+c] = new ver(-sx+cx, sy+cy, sz+cz);
v[7+c] = new ver(-sx+cx, -sy+cy, sz+cz);
// initialization of the faces
f[0+c1] = new face(0+c1, 0+c, 1+c, 2+c, 3+c);
f[1+c1] = new face(1+c1, 2+c, 3+c, 4+c, 5+c);
f[2+c1] = new face(2+c1, 4+c, 5+c, 6+c, 7+c);
f[3+c1] = new face(3+c1, 0+c, 1+c, 6+c, 7+c);
f[4+c1] = new face(4+c1, 0+c, 3+c, 4+c, 7+c);
f[5+c1] = new face(5+c1, 1+c, 2+c, 5+c, 6+c);
// initialization of the boxes
box[i] = new box3d(0+c1, 1+c1, 2+c1, 3+c1, 4+c1, 5+c1);
}
};
// ####################################################
// -- © 2002-2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// ####################################################
_root.onEnterFrame = function() {
var xa = -(cnx-_ymouse)*rad/15;
var ya = (cny-_xmouse)*rad/15;
var sinY = Math.sin(ya);
var cosY = Math.cos(ya);
var sinX = Math.sin(xa);
var cosX = Math.cos(xa);
for (var i = 0; i<=amount; i++) {
v[i].rotateXY(sinY, cosY, sinX, cosX);
v[i].perspective();
}
_root.clear();
if ((df++)%10 == 1) {
count = new Array();
for (var i = 0; i<=boxes; i++) {
count[i] = new Object();
count[i].z = box[i].zindex();
count[i].i = i;
}
// insert Sort
count = insertSort(count, 0, boxes);
}
for (var i = 0; i<=boxes; i++) {
box[count[boxes-i].i].fill();
}
};
stop();

------------------------------------------------------------------------------------

// Outline

// ################################################################
// -- © 2002 - 2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// ################################################################
max = 40;
this.createEmptyMovieClip("layer2_", 2);
this.createEmptyMovieClip("layer1_", 1);
this["layer2_"].beginFill(0xFF9900, 100);
this["layer2_"].moveTo(-100, -100);
this["layer2_"].lineTo(100, -100);
this["layer2_"].lineTo(100, 100);
this["layer2_"].lineTo(-100, 100);
this["layer2_"].lineTo(-100, -100);
this["layer1_"].beginFill(0x000000, 100);
this["layer1_"].moveTo(-100, -100);
this["layer1_"].lineTo(100, -100);
this["layer1_"].lineTo(100, 100);
this["layer1_"].lineTo(-100, 100);
this["layer1_"].lineTo(-100, -100);
for (i=0; i<=max; i++) {
duplicateMovieClip("layer1_", "layer1_" add i, 100-i);
duplicateMovieClip("layer2_", "layer2_" add i, 50-i);
this["layer1_"+i]._visible = i%5 ? 0 : 1;
this["layer2_"+i]._visible = i%5 ? 0 : 1;
}
layer1_._visible = 0;
layer2_._visible = 0;
layer1_0._visible = 0;
layer2_0._visible = 0;
this.onEnterFrame = function() {
px += (_xmouse-this.layer1_0._x)/3, py += (_ymouse-this.layer1_0._y)/3;
layer1_0._x=layer2_0._x=px, layer1_0._y=layer2_0._y=py;
xs=Math.sin(count += 0.3)*6, ys=Math.cos(count)*6;
for (i=max; i>0; i--) {
this["layer1_"+i]._x = this["layer2_"+i]._x=this["layer1_"+(i-1)]._x;
this["layer1_"+i]._y = this["layer2_"+i]._y=this["layer1_"+(i-1)]._y;
this["layer1_"+i]._xscale = this["layer1_"+(i-1)]._xscale-xs;
this["layer1_"+i]._yscale = this["layer1_"+(i-1)]._yscale-ys;
this["layer2_"+i]._xscale = this["layer1_"+(i-1)]._xscale-xs+7;
this["layer2_"+i]._yscale = this["layer1_"+(i-1)]._yscale-ys+7;
this["layer1_"+i]._rotation = this["layer2_"+i]._rotation=this["layer1_"+(i-1)]._rotation-3;
}
};


------------------------------------------------------------------------------------

// Outline 2

// ################################################################
// -- © 2002 - 2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// -- OUTLINE 2
// ################################################################
MovieClip.prototype.newCurve = function(x1, y1, x2, y2, x3, y3) {
var nx = 2*x2-0.5*(x1+x3);
var ny = 2*y2-0.5*(y1+y3);
this.curveTo(nx, ny, x3, y3);
};
MovieClip.prototype.drawCircle = function(c, wd, hg) {
var mas = new Array();
var angle = 360/c;
for (var i = 0; i<=c; i++) {
mas[i] = new Object();
mas[i].x = Math.cos(angle*(Math.PI/180)*i)*wd;
mas[i].y = Math.sin(angle*(Math.PI/180)*i)*hg;
}
this.moveTo(mas[0].x, mas[0].y);
for (var i = 0; i<c; i += 2) {
this.newCurve(mas[i].x, mas[i].y, mas[i+1].x, mas[i+1].y, mas[i+2].x, mas[i+2].y);
}
};
max = 40;
radius = 100;
this.createEmptyMovieClip("layer2_", 2);
this.createEmptyMovieClip("layer1_", 1);
this["layer2_"].beginFill(0xFF9900, 100);
this["layer2_"].drawCircle(16, radius, radius);
this["layer2_"].endFill();
this["layer1_"].beginFill(0x000000, 100);
this["layer1_"].drawCircle(16, radius, radius);
this["layer1_"].endFill();
for (i=0; i<=max; i++) {
duplicateMovieClip("layer1_", "layer1_" add i, 100-i);
duplicateMovieClip("layer2_", "layer2_" add i, 50-i);
this["layer1_"+i]._visible = i%5 ? 0 : 1;
this["layer2_"+i]._visible = i%5 ? 0 : 1;
}
layer1_._visible = 0;
layer2_._visible = 0;
layer1_0._visible = 0;
layer2_0._visible = 0;
this.onEnterFrame = function() {
px += (_xmouse-this.layer1_0._x)/3, py += (_ymouse-this.layer1_0._y)/3;
layer1_0._x=layer2_0._x=px, layer1_0._y=layer2_0._y=py;
xs=Math.sin(count += 0.3)*6, ys=Math.cos(count)*6;
for (i=max; i>0; i--) {
this["layer1_"+i]._x = this["layer2_"+i]._x=this["layer1_"+(i-1)]._x;
this["layer1_"+i]._y = this["layer2_"+i]._y=this["layer1_"+(i-1)]._y;
this["layer1_"+i]._xscale = this["layer1_"+(i-1)]._xscale-xs;
this["layer1_"+i]._yscale = this["layer1_"+(i-1)]._yscale-ys;
this["layer2_"+i]._xscale = this["layer1_"+(i-1)]._xscale-xs+8;
this["layer2_"+i]._yscale = this["layer1_"+(i-1)]._yscale-ys+8;
this["layer1_"+i]._rotation = this["layer2_"+i]._rotation=this["layer1_"+(i-1)]._rotation-3;
}
};

nuran
14.06.2003, 08:28
------------------------------------------------------------------------------------

// SUN

// ################################################################
// -- © 2002 - 2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// -- SUN
// ################################################################
this.createEmptyMovieClip("mc", 1);
MovieClip.prototype.newCurve = function(x1, y1, x2, y2, x3, y3) {
var nx = 2*x2-0.5*(x1+x3);
var ny = 2*y2-0.5*(y1+y3);
this.curveTo(nx, ny, x3, y3);
};
MovieClip.prototype.drawCircle = function(c, wd, hg) {
var mas = new Array();
var angle = 360/c;
for (var i = 0; i<=c; i++) {
mas[i] = new Object();
mas[i].x = Math.cos(angle*(Math.PI/180)*i)*wd;
mas[i].y = Math.sin(angle*(Math.PI/180)*i)*hg;
}
this.moveTo(mas[0].x, mas[0].y);
for (var i = 0; i<c; i += 2) {
this.newCurve(mas[i].x, mas[i].y, mas[i+1].x, mas[i+1].y, mas[i+2].x, mas[i+2].y);
}
};
radius = 80;
matrix = {matrixType:"box", x:-radius, y:-radius, w:radius*2, h:radius*2, r:radius*Math.PI};
this["mc"].beginGradientFill("radial", [0xFFFF00, 0xFF0000, 0xFFFF00], [100, 100, 100], [0, 0xCC, 0xFF], matrix);
this["mc"].lineStyle(0, 0x000000, 100);
this["mc"].drawCircle(16, radius, radius);
this["mc"].endFill();
stop();
max = 12;
for (i=0; i<=max; i++) {
this["mc"].duplicateMovieClip("ko"+i, 1000-i);
}
this["mc"].removeMovieClip();
ko0._visible = 0;
ko1._visible = 0;
this.onEnterFrame = function() {
if (ct%2 != 1) {
count++;
bg0._x = ko0._x=posx += (Math.cos(count/6)*420-ko0._x)/2+stage.width/4;
bg0._y = ko0._y=posy += (Math.sin(count/6)*200-ko0._y)/2+stage.height/4;
for (i=max; i>0; i--) {
eval("ko"+i)._x = eval("ko"+(i-1))._x;
eval("ko"+i)._y = eval("ko"+(i-1))._y;
eval("ko"+i)._xscale = eval("ko"+(i-1))._xscale-(130-Math.cos(count/3)*30);
eval("ko"+i)._yscale = eval("ko"+(i-1))._yscale-(130-Math.cos(count/3)*30);
}
}
};
_root.onMouseDown = function() {
ct++;
};
stop();

------------------------------------------------------------------------------------

// WOOL

// ##################################################################
// WOOL EFFECT
// © 2002 - 2003 Grigory Ryabov. All Rights Reserved.
// http://www.flash.plux.ru
// ##################################################################
c._x = 95;
c._y = 55;
max = 10;
dist = 35;
rad = Math.PI/180;
createEmptyMovieClip("c", 300);
for (i=1; i<=(max*max); i++) {
c.duplicateMovieClip("c"+i, i);
this["c"+i]._x = this["c"+(i-1)]._x+dist;
this["c"+i]._y = this["c"+(i-1)]._y;
this["c"+i].lineStyle(2, 0x000000, 100);
this["c"+i].moveTo(0, 0);
this["c"+i].lineTo(35, 35);
this["c"+i].onEnterFrame = function() {
this.angle = Math.atan2(_ymouse-this._y, _xmouse-this._x)/rad;
this._rotation = this.angle+135;
};
if (i%max == 1) {
this["c"+i]._y += dist;
this["c"+i]._x = this["c"]._x;
}
}
c.removeMovieClip();
stop();

------------------------------------------------------------------------------------

// FLAME

// ##############################################################
// (c) 2003 Grigory Ryabov
// http://www.flash.plux.ru
// FLASH MX FLAME EFFECT
// ##############################################################
if (frst != 10) {
frst = 10;
this.createEmptyMovieClip("c_", 2);
this.createEmptyMovieClip("worm1", 3);
this.createEmptyMovieClip("worm2", 1);
max = 30;
for (i=0; i<=max; i++) {
duplicateMovieClip("c_", "c1_"+i, i+400);
duplicateMovieClip("c_", "c2_"+i, i+100);
}
this.onEnterFrame = function() {
count++;
c1_0._x = 250+Math.cos(count/2)*3;
c1_0._y = 250;
c2_0._x = 250+Math.cos(count/2)*3;
c2_0._y = 250;
this["worm"+1].clear();
this["worm"+1].moveTo(this["c"+1+"_"+max]._x, this["c"+1+"_"+max]._y);
this["worm"+2].clear();
this["worm"+2].moveTo(this["c"+2+"_"+max]._x, this["c"+2+"_"+max]._y);
for (i=max; i>0; i--) {
this["c1_"+i]._x = this["c1_"+(i-1)]._x;
this["c1_"+i]._y = this["c1_"+(i-1)]._y+Math.cos(count/10)*3-4;
this["c2_"+i]._x = this["c2_"+(i-1)]._x;
this["c2_"+i]._y = this["c2_"+(i-1)]._y+Math.cos(count/10)*3-4;
r = -(Math.abs(Math.sin(count/20))*i+1)*8;
g = -(Math.abs(Math.sin(count/20))*i+1)*8;
b = 0;
worm1.lineStyle((max-i)*1.5, r << 16 | g << 8 | b,40);
worm1.lineTo(this["c1_"+i]._x, this["c1_"+i]._y);
worm2.lineStyle((max-i)*2, 255 << 16 | 00 << 8 | 00, 50);
worm2.lineTo(this["c2_"+i]._x, this["c2_"+i]._y);
}
};
}

------------------------------------------------------------------------------------

ну и как Вам???

ещё хотите???

прошу ко мне в гости

http://www.flash.plux.ru

Григорий А. Рябов (nuran)
Россия г.Тюмень

greyshaman
14.06.2003, 11:53
как всегда, смешно,а особенно веселит слово "мои".

nuran
14.06.2003, 11:55
ты идиот или как ???
с глупыми не спорю

iLoveYou
14.06.2003, 15:48
ну вопщем я во флешь загнал один - запарился набивать!
я конешно сомневаюсь, но без вот этих строк
// FLAME

// ##############################################################
// (c) 2003 Grigory Ryabov
// http://www.flash.plux.ru
// FLASH MX FLAME EFFECT
// ##############################################################
работать будет?

УильямБрэдберри
14.06.2003, 17:03
молодец
хороший код

Пушистик
17.06.2003, 15:35
А есть ли какой-то основно принцип построения этих поделей..?ведь это псевдо 3д....

llllllllll
17.06.2003, 16:21
Есть такой дядька AHAB ака Brandon Williams (с бывшего were-here.com) - вот у него был хороший набор ... vector2DClass, vector3DClass, matrixClass и т д ...

http://www.galaxygoo.org/blogs/mathLinks/
тут Math in Flash ... там тоже можно погулять :) :) :)

УильямБрэдберри
17.06.2003, 16:48
Оригинал написал(а) Пушистик
А есть ли какой-то основно принцип построения этих поделей..?ведь это псевдо 3д....

да нет, это как раз не псевдо
это как раз риал-тайм-просчет.

вот только флэша мало тянет, а так...
ждем "централа"

llllllllll
17.06.2003, 16:51
Оригинал написал(а) УильямБрэдберри

... а так...
ждем "централа"

Я конечно понимаю, что самый отсталый из всех :), но какого централа? :)

Пушистик
17.06.2003, 23:45
Уилл, а ты бы смоги замутить чё та типа этого...?а потом туториал бы сделал:)

cyraxchel
18.06.2003, 20:00
2 УильямБрэдберри: Реально. Сделай такой туториал. У тебя к ним талант.

nuran
20.06.2003, 08:48
Я шас вас всех застрелю. Хватит меня в плагиате обвинять.
Все исходники написал я сам. Ничего не спёр. Ничего не утащил. Знающие люди не станут обвинять меня в плагиате таких лёгких исходников.

ЁПРСТ.

llllllllll
20.06.2003, 14:08
млин, да я тока шас пригляделся, что там такое :), и сайт я твой видел раньше - еще тогда в шоке был, тока он маленько другой был =), у меня даже есть папочка в избранном - "suxx" :)))

УильямБрэдберри
20.06.2003, 19:57
Оригинал написал(а) llllllllll


Я конечно понимаю, что самый отсталый из всех :), но какого централа? :)
http://www.macromedia.com/cfusion/search/index.cfm?loc=en_us&term=central

llllllllll
20.06.2003, 20:05
Оригинал написал(а) УильямБрэдберри

http://www.macromedia.com/cfusion/search/index.cfm?loc=en_us&term=central

УильямБрэдберри, спасибо конечно, но там есть и более конкретный раздел, чем поиск - это я видел :), но я немного не про то, я про другое, чего ты ждешь от него такого неслыханного? :)

DeliMIter
21.06.2003, 20:33
Оригинал написал(а) УильямБрэдберри
молодец
хороший код Уилл, ты неправ. Плохой код. Аккуратный - может быть. Работающий - тоже может быть. Но. Длинный. Неоптимальный. Неалгоритмичный. Неоригинальный. Сложный. Эвалы.

nuran
19.08.2003, 14:30
всем спасибо за комментарии

nuran
28.08.2003, 08:13
vertex = function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
vertex.prototype.rotateXY = function(sinX, cosX, sinY, cosY) {
//rotation around of axes X and Y
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;
};
vertex.prototype.perspective = function() {
//calculation 3d to 2d
var perRatio = 1/(this.z/dist+1);
this.rx = cnx+this.x*perRatio;
this.ry = cny+this.y*perRatio;
};
face = function (c, v1, v2, v3, v4) {
this.c = c;
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
};
face.prototype.draw = function() {
var shadow = 130+((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))/5;
_root.lineStyle(0, 0x000000, 100);
_root.beginFill(shadow << 16 | shadow << 8 | shadow << 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.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 *= -1;
}
if (vis>=0) {
this.draw();
}
};
_root.onLoad = function() {
cnx = 250;
cny = 250;
dist = 200;
rad = Math.PI/180;
amount = 33;
v = new Array();
radius = 100;
step = 4;
next = 0;
c = 0;
// build sphere
while (next<=step) {
next++;
angstp = 180/(step+1);
while (c<=((amount-2)*next)/step) {
ang += 360/(((amount-2)+1)/step);
angle = ang*rad;
newrad = radius*Math.sin(next*angstp*rad);
v[c] = new vertex(Math.cos(angle)*newrad, Math.sin(angle)*newrad, radius*Math.cos(next*angstp*rad));
c++;
}
ang = 0;
}
// ------------------------------------
v[amount-1] = new vertex(0, 0, radius);
v[amount] = new vertex(0, 0, -radius);
// initialization of the faces
f = new Array();
f[0] = new face(0, 0, 1, 9, 8);
f[1] = new face(1, 9, 10, 2, 1);
f[2] = new face(0, 2, 3, 11, 10);
f[3] = new face(1, 11, 12, 4, 3);
f[4] = new face(0, 4, 5, 13, 12);
f[5] = new face(1, 13, 14, 6, 5);
f[6] = new face(0, 6, 7, 15, 14);
f[7] = new face(0, 7, 0, 8, 15);
f[8] = new face(0, 8, 9, 17, 16);
f[9] = new face(1, 17, 18, 10, 9);
f[10] = new face(0, 10, 11, 19, 18);
f[11] = new face(1, 19, 20, 12, 11);
f[12] = new face(0, 12, 13, 21, 20);
f[13] = new face(1, 21, 22, 14, 13);
f[14] = new face(0, 14, 15, 23, 22);
f[15] = new face(1, 23, 16, 8, 15);
f[16] = new face(0, 16, 17, 25, 24);
f[17] = new face(1, 25, 26, 18, 17);
f[18] = new face(0, 18, 19, 27, 26);
f[19] = new face(1, 27, 28, 20, 19);
f[20] = new face(0, 20, 21, 29, 28);
f[21] = new face(1, 29, 30, 22, 21);
f[22] = new face(0, 22, 23, 31, 30);
f[23] = new face(1, 31, 24, 16, 23);
f[24] = new face(0, 30, 31, 33, 33);
f[25] = new face(0, 29, 30, 33, 33);
f[26] = new face(0, 28, 29, 33, 33);
f[27] = new face(0, 27, 28, 33, 33);
f[28] = new face(0, 26, 27, 33, 33);
f[29] = new face(0, 25, 26, 33, 33);
f[30] = new face(0, 24, 25, 33, 33);
f[31] = new face(0, 31, 24, 33, 33);
f[32] = new face(1, 0, 1, 32, 32);
f[33] = new face(1, 1, 2, 32, 32);
f[34] = new face(1, 2, 3, 32, 32);
f[35] = new face(1, 3, 4, 32, 32);
f[36] = new face(1, 4, 5, 32, 32);
f[37] = new face(1, 5, 6, 32, 32);
f[38] = new face(1, 6, 7, 32, 32);
f[39] = new face(1, 7, 0, 32, 32);
faces = 39;
};
// ####################################################
// -- © 2002-2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// -- 3d sphere
// ####################################################
this.onEnterFrame = function() {
var xa = -(cnx-_ymouse)*rad/15;
var ya = (cny-_xmouse)*rad/15;
var sinY = Math.sin(ya);
var cosY = Math.cos(ya);
var sinX = Math.sin(xa);
var cosX = Math.cos(xa);
for (var i = 0; i<=amount; i++) {
v[i].rotateXY(sinY, cosY, sinX, cosX);
v[i].perspective();
}
_root.clear();
for (var i = 0; i<=faces; i++) {
f[i].fill();
}
};
stop();

nuran
28.08.2003, 08:14
// Это вообще легко и просто
MovieClip.prototype.drawBezierCircle = function(shadow, x1, y1, x2, y2, x3, y3, x4, y4) {
cx1 = x1+(x2-x1)/2;
cy1 = y1+(y2-y1)/2;
cx2 = x2+(x3-x2)/2;
cy2 = y2+(y3-y2)/2;
cx3 = x3+(x4-x3)/2;
cy3 = y3+(y4-y3)/2;
cx4 = x4+(x1-x4)/2;
cy4 = y4+(y1-y4)/2;
this.lineStyle(0, 0x000000, 100);
this.beginFill(shadow << 16 | shadow << 8 | shadow << 0, 100);
this.moveTo(cx1, cy1);
this.curveTo(x2, y2, cx2, cy2);
this.curveTo(x3, y3, cx3, cy3);
this.curveTo(x4, y4, cx4, cy4);
this.curveTo(x1, y1, cx1, cy1);
this.endFill();
};
vertex = function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
vertex.prototype.rotateXY = function(sinX, cosX, sinY, cosY) {
//rotation around of axes X and Y
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;
};
vertex.prototype.perspective = function() {
//calculation 3d to 2d
var perRatio = 1/(this.z/dist+1);
this.rx = cnx+this.x*perRatio;
this.ry = cny+this.y*perRatio;
};
face = function (c, v1, v2, v3, v4) {
this.c = c;
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
};
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.draw = function() {
var shadow = 140+((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))/8;
_root.drawBezierCircle(shadow,v[this.v1].rx, v[this.v1].ry, v[this.v2].rx, v[this.v2].ry, v[this.v3].rx, v[this.v3].ry, v[this.v4].rx, v[this.v4].ry);
};
face.prototype.fill = function() {
this.draw();
};
insertSort = 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);
};
_root.onLoad = function() {
cnx = 200;
cny = 200;
dist = 270;
var sx = 75;
var sy = 75;
var sz = 75;
rad = Math.PI/180;
faces = 5;
amount = 7;
// initialization of the vertex
v = new Array();
v[0] = new vertex(sx, -sy, sz);
v[1] = new vertex(sx, sy, sz);
v[2] = new vertex(sx, sy, -sz);
v[3] = new vertex(sx, -sy, -sz);
v[4] = new vertex(-sx, -sy, -sz);
v[5] = new vertex(-sx, sy, -sz);
v[6] = new vertex(-sx, sy, sz);
v[7] = new vertex(-sx, -sy, sz);
// initialization of the faces
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);
f[4] = new face(4, 0, 3, 4, 7);
f[5] = new face(5, 1, 2, 5, 6);
};
// ####################################################
// -- © 2002-2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// -- 3D CUBE + BezierCircle + Z Sort
// ####################################################
insertSorting = function () {
count = new Array();
for (var i = 0; i<=faces; i++) {
count[i] = new Object();
count[i].z = f[i].zindex();
count[i].i = i;
}
count = insertSort(count, 0, faces);
for (var i = 0; i<=faces; i++) {
f[count[faces-i].i].fill();
}
};
_root.onEnterFrame = function() {
_root.clear();
for (var i = 0; i<=amount; i++) {
var xa = -(cnx-_ymouse)*rad/25;
var ya = (cny-_xmouse)*rad/25;
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].perspective();
}
insertSorting();
};
stop();

nuran
01.09.2003, 12:34
MovieClip.prototype.newCurve = function(x1, y1, x2, y2, x3, y3) {
var nx = 2*x2-0.5*(x1+x3);
var ny = 2*y2-0.5*(y1+y3);
this.curveTo(nx, ny, x3, y3);
};
MovieClip.prototype.drawCircle = function(c, wd, hg) {
var mas = new Array();
var angle = 360/c;
for (var i = 0; i<=c; i++) {
mas[i] = new Object();
mas[i].x = Math.cos(angle*(Math.PI/180)*i)*wd;
mas[i].y = Math.sin(angle*(Math.PI/180)*i)*hg;
}
this.moveTo(mas[0].x, mas[0].y);
for (var i = 0; i<c; i += 2) {
this.newCurve(mas[i].x, mas[i].y, mas[i+1].x, mas[i+1].y, mas[i+2].x, mas[i+2].y);
}
};
vertex = function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
vertex.prototype.rotateXY = function(sinX, cosX, sinY, cosY) {
//rotation around of axes X and Y
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;
};
vertex.prototype.perspective = function() {
//calculation 3d to 2d
var perRatio = 1/(this.z/dist+1);
this.rx = cnx+this.x*perRatio;
this.ry = cny+this.y*perRatio;
};
_root.onLoad = function() {
cnx = 250;
cny = 250;
dist = 200;
rad = Math.PI/180;
amount = 33;
v = new Array();
radius = 100;
step = 4;
next = 0;
c = 0;
createEmptyMovieClip("dot", 100);
dot.lineStyle(0, 0xFFFFFF, 100);
dot.beginFill(0x000000, 100);
dot.drawCircle(16, 15, 15);
dot.endFill();
// build sphere
while (next<=step) {
next++;
angstp = 180/(step+1);
while (c<=((amount-2)*next)/step) {
if (c>amount) {
break;
}
ang += 360/(((amount-2)+1)/step);
angle = ang*rad;
newrad = radius*Math.sin(next*angstp*rad);
v[c] = new vertex(Math.cos(angle)*newrad, Math.sin(angle)*newrad, radius*Math.cos(next*angstp*rad));
duplicateMovieClip("dot", "dot"+c, c);
c++;
}
ang = 0;
}
dot.removeMovieClip();
// ------------------------------------
v[amount-1] = new vertex(0, 0, radius);
v[amount] = new vertex(0, 0, -radius);
};
// ####################################################
// -- © 2002-2003 Grigory Ryabov.
// -- http://www.flash.plux.ru
// -- 3d sphere 2
// ####################################################
_root.onEnterFrame = function() {
var xa = -(cnx-_ymouse)*rad/25;
var ya = (cny-_xmouse)*rad/25;
var sinY = Math.sin(ya);
var cosY = Math.cos(ya);
var sinX = Math.sin(xa);
var cosX = Math.cos(xa);
for (var i = 0; i<=amount; i++) {
v[i].rotateXY(sinY, cosY, sinX, cosX);
v[i].perspective();
perRatio = 1/(v[i].z/dist+1);
this["dot"+i]._x = v[i].rx;
this["dot"+i]._y = v[i].ry;
this["dot"+i]._xscale = this["dot"+i]._yscale=perRatio*50;
this["dot"+i].swapDepths(perRatio*500);
}
_root.clear();
_root.lineStyle(0, 0xCCCCCC, 100);
for (var c = 0; c<step; c++) {
_root.moveTo(v[c*8].rx, v[c*8].ry);
for (var i = c*8; i<=(c*8+7); i++) {
_root.lineTo(v[i].rx, v[i].ry);
}
_root.lineTo(v[c*8].rx, v[c*8].ry);
}
for (var i = 0; i<=23; i++) {
_root.moveTo(v[i].rx, v[i].ry);
_root.lineTo(v[i+8].rx, v[i+8].ry);
}
// -------------------------
for (var i = 0; i<=7; i++) {
_root.moveTo(v[amount-1].rx, v[amount-1].ry);
_root.lineTo(v[i].rx, v[i].ry);
}
for (var i = 24; i<=31; i++) {
_root.moveTo(v[amount].rx, v[amount].ry);
_root.lineTo(v[i].rx, v[i].ry);
}
};
stop();

nuran
01.09.2003, 12:35
// ################################################################
// -- (c) 2002-2003 Grigory RYABOV.
// -- http://www.flash.plux.ru
// -- CLOTH MX
// ################################################################
MovieClip.prototype.newCurve = function(x1, y1, x2, y2, x3, y3) {
var nx = 2*x2-0.5*(x1+x3);
var ny = 2*y2-0.5*(y1+y3);
this.curveTo(nx, ny, x3, y3);
};
MovieClip.prototype.drawCircle = function(c, wd, hg) {
var mas = new Array();
var angle = 360/c;
for (var i = 0; i<=c; i++) {
mas[i] = new Object();
mas[i].x = Math.cos(angle*(Math.PI/180)*i)*wd;
mas[i].y = Math.sin(angle*(Math.PI/180)*i)*hg;
}
this.moveTo(mas[0].x, mas[0].y);
for (var i = 0; i<c; i += 2) {
this.newCurve(mas[i].x, mas[i].y, mas[i+1].x, mas[i+1].y, mas[i+2].x, mas[i+2].y);
}
};
radius = 70;
this.createEmptyMovieClip("layer2_", 2);
this.createEmptyMovieClip("layer1_", 1);
this["layer2_"].beginFill(0xFFFFFF, 100);
this["layer2_"].drawCircle(16, radius, radius);
this["layer2_"].endFill();
this["layer1_"].beginFill(0x333333, 100);
this["layer1_"].drawCircle(16, radius, radius);
this["layer1_"].endFill();
max = 20;
for (i=0; i<=max; i++) {
duplicateMovieClip("layer1_", "layer1_" add i, 100-i);
duplicateMovieClip("layer2_", "layer2_" add i, 50-i);
}
layer1_._visible = layer1_0._visible=layer2_._visible=layer2_0._visible=0;
function mouse() {
px += (_xmouse-this.layer1_0._x)/3, py += (_ymouse-this.layer1_0._y)/3;
layer1_0._x=layer2_0._x=px, layer1_0._y=layer2_0._y=py;
xs=Math.sin(count += 0.3)*6, ys=Math.cos(count)*6;
for (i=max; i>0; i--) {
this["layer1_"+i]._x = this["layer2_"+i]._x=this["layer1_"+(i-1)]._x;
this["layer1_"+i]._y = this["layer2_"+i]._y=this["layer1_"+(i-1)]._y;
this["layer1_"+i]._xscale = this["layer1_"+(i-1)]._xscale-xs;
this["layer1_"+i]._yscale = this["layer1_"+(i-1)]._yscale-ys;
this["layer2_"+i]._xscale = this["layer1_"+(i-1)]._xscale-xs+1;
this["layer2_"+i]._yscale = this["layer1_"+(i-1)]._yscale-ys+1;
}
}
_root.onEnterFrame = function() {
mouse();
};