Frame 1
function mergeColor(a, b, mix) {
var _local2 = a >> 16;
var _local4 = (a >> 8) & 255;
var _local3 = a & 255;
var _local7 = b >> 16;
var _local9 = (b >> 8) & 255;
var _local8 = b & 255;
_local2 = (_local2 * (1 - mix)) + (_local7 * mix);
_local4 = (_local4 * (1 - mix)) + (_local9 * mix);
_local3 = (_local3 * (1 - mix)) + (_local8 * mix);
return(((_local2 << 16) | (_local4 << 8)) | _local3);
}
kNbrPts = 40;
SW = Stage.width;
SH = Stage.height;
MovieClip.prototype.makeWave = function (deep, clr, jit, turbProb) {
this.pts = [];
this.springs = [];
this.clr = clr;
this.jit = jit;
this.turbProb = turbProb;
this.deep = deep;
this.stiffK = 0.3;
this.kDamp = 0.85;
var _local3 = (SW + 100) / kNbrPts;
var _local2 = 0;
while (_local2 < kNbrPts) {
this.pts[_local2] = {x:-50 + (_local2 * _local3), y:0, fx:0, fy:0, vx:0, vy:0, restLen:0.5 * _local3, jy:0};
_local2++;
}
};
MovieClip.prototype.simWave = function () {
var _local2;
_local2 = 0;
while (_local2 < this.pts.length) {
this.pts[_local2].fx = 0;
if (Math.random() < this.turbProb) {
this.pts[_local2].fy = (Math.random() * this.jit) - (this.jit / 2);
} else {
this.pts[_local2].fy = 0;
}
_local2++;
}
_local2 = 0;
while (_local2 < (this.pts.length - 1)) {
var _local3 = this.pts[_local2];
var _local4 = this.pts[_local2 + 1];
var _local6 = _local4.x - _local3.x;
var _local5 = _local4.y - _local3.y;
var _local7 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
var _local9 = this.stiffK * (_local7 - _local3.restLen);
var _local10 = (_local9 * _local6) / _local7;
var _local8 = (_local9 * _local5) / _local7;
if (_local2 != 0) {
_local3.fx = _local3.fx + _local10;
_local3.fy = _local3.fy + _local8;
}
if (_local2 != (this.pts.length - 2)) {
_local4.fx = _local4.fx - _local10;
_local4.fy = _local4.fy - _local8;
}
_local2++;
}
this.clear();
this.beginFill(this.clr, 100);
this.moveTo(this.pts[0].x, this.pts[0].y);
_local2 = 1;
while (_local2 < (this.pts.length - 1)) {
pt = this.pts[_local2];
pt.vx = pt.vx * this.kDamp;
pt.vy = pt.vy * this.kDamp;
pt.vx = pt.vx + pt.fx;
pt.vy = pt.vy + pt.fy;
pt.x = pt.x + pt.vx;
pt.y = pt.y + pt.vy;
this.lineTo(pt.x, pt.y);
_local2++;
}
_local2 = this.pts.length - 1;
this.lineTo(this.pts[_local2].x, this.pts[_local2].y);
this.lineTo(this.pts[_local2].x, this.deep);
this.lineTo(this.pts[0].x, this.deep);
this.lineTo(this.pts[0].x, this.pts[0].y);
this.endFill();
};
var d = 0;
var vd = 64;
kNbrLines = 7;
var i = 0;
while (i < kNbrLines) {
var r = (i / (kNbrLines - 1));
var ir = (1 - r);
var mc = _root.createEmptyMovieClip("mc" + i, ((kNbrLines * 2) + 1) - (i * 2));
mc._x = 0;
mc._y = (SH / 2) - d;
var deep;
if (i == 0) {
deep = SH / 2;
} else {
deep = d * 2;
}
mc.makeWave(deep, mergeColor(3356487, 14079449, r * 0.9), 0.1 + ((4 * ir) * ir), 0.1);
mc.onEnterFrame = mc.simWave;
d = d + vd;
vd = vd / 2;
i++;
}
SS = 10;
MovieClip.prototype.drawShark = function () {
this.clear();
this.beginFill(mergeColor(3355443, mergeColor(6710937, 14079449, 0.8), 0.5), 100);
this.moveTo(-2 * SS, 0);
this.curveTo(-0.5 * SS, -1.5 * SS, -1 * SS, -2.75 * SS);
this.curveTo(-1 * SS, -3 * SS, -0.75 * SS, -3 * SS);
this.curveTo(1 * SS, -2 * SS, 2 * SS, 0);
this.lineTo(-2 * SS, 0);
this.endFill();
};
MovieClip.prototype.moveShark = function () {
this._x = this._x + 2;
if (this._x > (SW + this._width)) {
this._x = -SW;
}
var _local2 = getTimer() * 0.001;
this._y = this.cy + (Math.sin(_local2) * 5);
this._rotation = Math.sin(_local2 + 0.9) * 10;
};
var mc = _root.createEmptyMovieClip("shark", 12);
mc.cy = SH / 2.8;
mc._x = -SW;
mc._y = SH / 4;
mc.drawShark();
mc.onEnterFrame = mc.moveShark;