Код - в первом кадре. image - мувик, который ты хочешь превратить в волны.
Код:
effect = 0;
speed = 2;
slices = 50;
s = image._width / slices;
i = 0;
while (i < slices) {
_root.createEmptyMovieClip(("mask" + i), (slices + i));
msk = eval(("mask" + i));
with (msk) {
beginfill(0, 100);
moveto(i * s, 0);
lineto((i * s + s), 0);
lineto((i * s + s), stage.height);
lineto(i * s, stage.height);
lineto(i * s, 0);
endfill();
_x = 0;
_y = 0;
}
image.duplicateMovieClip(("slice" + i), i);
slc = eval(("slice" + i));
slc._x = 0;
slc._y = 0;
slc.setmask(msk);
i++;
}
aa = new Array();
ay = new Array();
p = 0;
while (p < slices) {
i = 0;
while (i < slices) {
if (effect == 1) {
ay[(p * slices + i)] = math.round((math.sin((i - p) / slices * 4 * math.pi) * 12 * i / slices + 12));
aa[(p * slices + i)] = math.round((math.sin(((i - p) + 6) / slices * 4 * math.pi) * 20 * i / slices + 80));
} else if (effect == 2) {
ay[(p * slices + i)] = math.round((math.sin((i - p) / slices * 4 * math.pi) * 12 + 12));
aa[(p * slices + i)] = 100;
} else if (effect == 3) {
ay[(p * slices + i)] = math.round(((math.sin((i - p) / slices * 2 * math.pi) + math.sin((i - p) / slices * 4 * math.pi)) * 6 + 12));
aa[(p * slices + i)] = 100;
} else if (effect == 4) {
ay[(p * slices + i)] = math.round(((math.abs((((i + p) % slices / 2) - slices / 4))) / (slices / 4) * 15 + 15));
aa[(p * slices + i)] = 100;
} else {
ay[(p * slices + i)] = math.round((math.sin((i - p) / slices * 2 * math.pi) * 12 * i / slices + 12));
aa[(p * slices + i)] = math.round((math.sin(((i - p) + 6) / slices * 2 * math.pi) * 20 * i / slices + 80));
}
i++;
}
p++;
}
p = 0;
_root.onEnterFrame = function() {
p = (p + speed) % slices;
i = 0;
while (i < slices) {
slc = eval(("slice" + i));
slc._alpha = aa[(p * slices + i)];
slc._y = ay[(p * slices + i)];
i++;
}
};
_root.stop();