Deseo lograr este mismo efecto que esta en este enlace
http://clipdepelicula.com/efecto-olas-con-flash/
solo que este funciona con la accion del mouse.. y mi deseo es que sea una animacion continua (sin salto) sin que intervenga la accion del mouse...
quizas se pueda usar el codigo del mismo... pero mis probres conocimientos de AS2... no me permiten modificar esto a mi favor
infinitamente agradecido por leer aca
saludos!
Lec
Este es el codigo que se le aplica al MC... un rectangulo
Código ActionScript :
this.createEmptyMovieClip("pool", 0);
pool.count = 40;
pool.spacing = 40;
pool.seaLevel = -80;
pool.delay = 3;
pool.accel = 0.06;
pool.fric = 0.99;
pool._x = 0;
pool._y = 0;
pool.init = function() {
this.pause = 0;
this.theFrame = 0;
this.curr_ymouse = this._ymouse;
this.points = new Array();
var point = 0;
while (point<this.count) {
this.points[this.points.length] = {x:point*this.spacing, y:this.seaLevel, speed:0, num:point, process:new Array(), nProcess:new Array()};
++point;
}
};
pool.makeWave = function(num, mag) {
this.points[num].speed += mag;
this.points[num-1].process[this.points[num-1].process.length] = [mag, -1];
this.points[num+1].process[this.points[num+1].process.length] = [mag, 1];
};
pool.mouseWaveNum = function() {
return Math.round(Math.min(Math.max((this._xmouse)/this.spacing, 0), this.count));
};
pool.onMouseMove = function() {
this.last_ymouse = this.curr_ymouse;
this.curr_ymouse = this._ymouse;
var thisNum = this.mouseWaveNum();
var curr_y = this.points[thisNum].y;
if (curr_ymouse<curr_y && curr_y<this.last_ymouse || curr_y<this.curr_ymouse && this.last_ymouse<curr_y) {
this.makeWave(thisNum, Math.min(Math.max(-1, (this.curr_ymouse-this.last_ymouse)*0.1), 1));
}
};
pool.onEnterFrame = function() {
var next, me, i, col;
var point = 0;
while (point<this.count) {
me = this.points[point];
me.speed += (this.seaLevel-me.y)*this.accel;
me.speed *= this.fric;
me.y += me.speed;
if (!this.pause) {
i = 0;
while (i<me.process.length) {
me.speed += me.process[i][0];
next = this.points[point+me.process[i][1]];
next.nProcess[next.nProcess.length] = me.process[i].slice();
++i;
}
}
++point;
}
var point = 0;
this.clear();
this.beginFill(0xFFFFFF, 100);
while (point<this.count) {
me = this.points[point];
if (!this.pause) {
me.process = me.nProcess;
me.nProcess = [];
}
if (!point) {
col = 0x333333;
} else {
col = 127+Math.min(Math.max(20*(this.points[point-1].y-me.y), -127), 128);
col = ((col/2) << 8) | col;
}
this.lineStyle(0, col, 100);
this.lineTo(me.x, me.y);
++point;
}
this.lineStyle(0, 0x333333, 100);
this.lineTo(me.x, 0);
this.lineTo(0, 0);
this.pause = this.theFrame++%this.delay;
};
pool.init();
