espero salga bien la levantada xq soy nueva en esta pag hehe!!!!
para aquellos que quieren personalizar su fondo web con una animación 3d hecha en flah aquí les va lo que hice...
OJO: si lo optimizan me pasan el dato jeje:
[flash width=600 height=337]C:\Documents and Settings\diseñador\Escritorio\AndReMicH-82\Personal\drivers\Tubo luminoso rotatorio.swf[/flash]
son 4 frames:
en el frame logic:
[// register root as Environment
Object.environment = this;
// set up cell properties
Object.environment.BITS = 15;
Object.environment.RULESET = 110;
Object.environment.RADIUS = 50;
// set text output
this.txtRuleSet.text = "Wolfram ruleset "+Object.environment.RULESET;
// create center stage to place rings
this.createEmptyMovieClip("centerStage",1);
this.centerStage._x=300;
this.centerStage._y=220;
// create initial random cell row
//Object.environment.cellrow=randomCells();
// create just one centered seed bit
Object.environment.cellrow=Math.pow(2,Math.ceil(Object.environment.BITS/2));
// apply rules
growInterval = setInterval(this,"grow",320);
this.onMouseDown = function() {
// reset destination clock
this.cnt=0;
// center object
this.dx=lastx;
this.dy=lasty;
};
this.onMouseUp = function() {
// change RULESET
Object.environment.RULESET = random(255);
// set initially random ruleset
Object.environment.cellrow = randomCells();
// set text output
this.txtRuleSet.text = "Wolfram ruleset "+Object.environment.RULESET;
};
this.onEnterFrame = function() {
// adjust rotational velocity
this.speed=neoring._xmouse/20;
// rotate structure
this.omega+=this.speed;
// focus on current destination
this.vx+=(-this.dx-centerStage._x+300)/50;
this.vy+=(-this.dy-centerStage._y+169)/50;
centerStage._x+=this.vx;
centerStage._y+=this.vy;
// friction
this.vx*=.8;
this.vy*=.8;
// refresh destination periodically
if (this.cnt++>(50+random(100))) {
this.cnt=0;
// set destination to last placed ring
this.dx=lastx;
this.dy=lasty;
}
}
stop();]
en el frame fuctions:
[/function grow() {
// repeatedly apply automata rule on cellrow
drawCellRow(cellrow);
cellrow=applyRule();
}
function binaryToDecimal(bin) {
var s = new String(bin);
var dec = 0;
for (var i=0;i<Object.environment.BITS; i++) {
var lsb = s.charAt(i);
dec+=parseInt(lsb)*Math.pow(2,i);
bin >>= 1;
}
return dec;
}
function randomCells() {
var result = 0;
for (var i = 0; i<Object.environment.BITS; i++) {
if (random(2)) {
result += Math.pow(2, i);
}
}
return Number(result);
}
function drawCellRow(number) {
// create ring holder
var nombre = "bitring"+String(depth++);
neoring = centerStage.createEmptyMovieClip(nombre,depth);
// draw guide wire
// neoring.lineStyle(0,0xFFFFFF,100);
// neoring.moveTo(100,0);
// neoring.lineTo(-100,0);
// offset from last known position
vRot+=(random(101)-50)/50;
while (Math.abs(vRot)>20) {
vRot*=.7;
}
neoring._rotation=lastRot+vRot;
neoring._x=lastx-20*Math.sin(Math.PI / 180 * lastRot);
neoring._y=lasty+20*Math.cos(Math.PI / 180 * lastRot);
// record last known position
lastRot=neoring._rotation;
lastx=neoring._x;
lasty=neoring._y;
// render the row of cells
for (var i = 0; i<Object.environment.BITS; i++) {
// Extract least significant bit using bitwise AND
var lsb = number & 1;
if (lsb) {
// create the movieclip for the bit
nombre = "bit" + String(depth++);
neo = neoring.attachMovie("bitSquare", nombre, depth);
neo._x = (xo + Object.environment.BITS - i) * 10;
neo.theta = i * 360/Object.environment.BITS;
}
// shift number right by one bit, to see next bit
number >>= 1;
}
yo++;
}
function applyRule() {
var result = "";
var number = Object.environment.cellrow;
// calculate new row one cell at a time
for (var i = 0; i<Object.environment.BITS; i++) {
// find middle rule bit
var n1 = (number & (1 << i) ? "1" : "0");
if (i == 0) {
// loop around to end
var n0 = (number & (1 << (Object.environment.BITS-1)) ? "1" : "0");
var n2 = (number & (1 << (i+1)) ? "1" : "0");
} else if (i == (Object.environment.BITS-1)) {
// loop around to beginning
var n0 = (number & (1 << (i-1)) ? "1" : "0");
var n2 = ((number & 1) ? "1" : "0");
} else {
var n0 = (number & (1 << (i-1)) ? "1" : "0");
var n2 = (number & (1 << (i+1)) ? "1" : "0");
}
var ruleNumber = n2 << 2 | n1 << 1 | n0;
var ruleOutcome = Object.environment.RULESET >> ruleNumber;
var lsb = ruleOutcome & 1;
result = result + (lsb ? "1" : "0");
}
var n = binaryToDecimal(result);
return n;
}]
en el frame gravity: ubicar uana bandera en el 1.1 de la línea de tiempo así mismo F5 hasta el 45
en el frame ant lo mismo que gravity, pero con los mensajes de llamado diferentes.
sólo está un solo cuadro en la libreria, un movie clip llamado bitSquare (obvio la forma geometrica)
saludillos!!!!