Frame 1
FilmSpace = new Object();
FilmSpace.px = 0;
FilmSpace.py = 270;
FilmSpace.pz = -50;
FilmSpace.ceiling = 100;
FilmSpace.perspex = 1000;
FilmSpace.offset = -100;
_global.grav = 0.25;
Layout = function () {
var _local1 = this;
_local1.width = 450;
_local1.height = 450;
_local1.ox = stage.width / 2;
_local1.oy = stage.height / 2;
_local1.cellRows = 4;
_local1.cellCols = 4;
_local1.gap = 0;
};
Function.prototype.ptype = function (superClass) {
var _local1 = this;
_local1.prototype.__constructor__ = superClass;
ASSetPropFlags(_local1.prototype, "__constructor__", 1);
_local1.prototype.__proto__ = superClass.prototype;
};
compress = function (value) {
var _local1 = value;
if (_local1 > PI) {
_local1 = _local1 - (PI * 2);
} else if (_local1 < (-PI)) {
_local1 = _local1 + (PI * 2);
}
return(_local1);
};
Sin = Math.sin;
Cos = Math.cos;
aTan2 = Math.atan2;
asin = Math.asin;
acos = Math.acos;
abs = Math.abs;
sqrt = Math.sqrt;
PI = Math.PI.valueOf();
MovieClip.newClip = MovieClip.createEmptyMovieClip;
cosh = function (x) {
var _local1 = (Math.pow(Math.E, x) + Math.pow(Math.E, -x)) / 2;
return(_local1);
};
Pyt = function (x, y) {
return(sqrt((x * x) + (y * y)));
};
sift = function (tempVar, def) {
var _local1 = tempVar;
if ((_local1 == undefined) or (_local1 == 0)) {
return(def);
}
return(_local1);
};
branch = function (tempVar, def1, def2) {
if ((tempVar == undefined) or (tempVar == 0)) {
return(def2);
}
return(def1);
};
Ybranch = function (tempVar, def1, def2, def3) {
var _local1 = tempVar;
if ((_local1 == undefined) or (_local1 == 0)) {
return(def2);
}
if (_local1 == 1) {
return(def1);
}
if (_local1 == -1) {
return(def3);
}
return(undefined);
};
AngleSplit = function (num1, num2, factor) {
var _local1 = num2;
var _local2 = factor;
var _local3 = num1;
if (_local2 == undefined) {
_local2 = 1;
}
if (abs(_local3 - _local1) > PI) {
if (_local3 > _local1) {
_local3 = _local3 - (PI * 2);
} else {
_local1 = _local1 - (PI * 2);
}
}
var av = compress(((_local3 * _local2) + _local1) / (_local2 + 1));
return(av);
};
Object.prototype.TangentFinder = function (x, y, r) {
var _local1 = this;
var _local2 = r;
var _local3 = y;
var j = ((x * x) + (_local3 * _local3));
var k = sqrt(j - (_local2 * _local2));
var ra1 = acos(((_local2 * x) + (_local3 * k)) / j);
var ra2 = acos(((_local2 * x) - (_local3 * k)) / j);
var tx1 = (_local2 * cos(ra1));
var ty1 = (_local2 * sin(ra1));
var td1 = sqrt(((ty1 - _local3) * (ty1 - _local3)) + ((tx1 - x) * (tx1 - x)));
var tx2 = (_local2 * cos(-ra1));
var ty2 = (_local2 * sin(-ra1));
var td2 = sqrt(((ty2 - _local3) * (ty2 - _local3)) + ((tx2 - x) * (tx2 - x)));
var tx3 = (_local2 * cos(ra2));
var ty3 = (_local2 * sin(ra2));
var td3 = sqrt(((ty3 - _local3) * (ty3 - _local3)) + ((tx3 - x) * (tx3 - x)));
var tx4 = (_local2 * cos(-ra2));
var ty4 = (_local2 * sin(-ra2));
var td4 = sqrt(((ty4 - _local3) * (ty4 - _local3)) + ((tx4 - x) * (tx4 - x)));
if (abs(td2 - td4) < 0.0001) {
_local1.xt1 = tx2;
_local1.yt1 = ty2;
_local1.xt2 = tx4;
_local1.yt2 = ty4;
} else if (abs(td2 - td3) < 0.0001) {
_local1.xt1 = tx2;
_local1.yt1 = ty2;
_local1.xt2 = tx3;
_local1.yt2 = ty3;
} else if (abs(td1 - td4) < 0.0001) {
_local1.xt1 = tx1;
_local1.yt1 = ty1;
_local1.xt2 = tx4;
_local1.yt2 = ty4;
} else if (abs(td1 - td3) < 0.0001) {
_local1.xt1 = tx1;
_local1.yt1 = ty1;
_local1.xt2 = tx3;
_local1.yt2 = ty3;
}
};
kolor = function () {
};
kolor.prototype = new Object();
kolor.prototype.kolorBreak = function () {
var _local2 = this;
var _local1 = new Array(_local2.hex.substr(2, 2), _local2.hex.substr(4, 2), _local2.hex.substr(6, 2));
_local2.rgb = new Array();
c = 0;
while (c < 3) {
n1 = hexDigit(_local1[c].substr(0, 1));
n2 = hexDigit(_local1[c].substr(1, 1));
_local2.rgb[c] = (n1 * 16) + n2;
c++;
}
};
hexdigit = function (num) {
var _local1 = num;
if (_local1 < 10) {
_local1 = Number(_local1);
} else if ((_local1 == "A") or (_local1 == "a")) {
_local1 = 10;
} else if ((_local1 == "B") or (_local1 == "b")) {
_local1 = 11;
} else if ((_local1 == "C") or (_local1 == "c")) {
_local1 = 12;
} else if ((_local1 == "D") or (_local1 == "d")) {
_local1 = 13;
} else if ((_local1 == "E") or (_local1 == "e")) {
_local1 = 14;
} else if ((_local1 == "F") or (_local1 == "f")) {
_local1 = 15;
}
return(_local1);
};
function cursor() {
}
function Being() {
}
function idCount() {
idCounter = idCounter + 1;
return(idCounter);
}
function sCurve(num) {
var _local1 = 1 - ((1 + cos(num * PI)) / 2);
return(_local1);
}
function iuratio(num) {
var _local1 = abs((num - 0.5) * 2);
var _local2 = 1 - (_local1 * _local1);
return(_local2);
}
function softHill(num) {
var _local1 = cos((((num - 0.5) * 2) * PI) / 2);
return(_local1);
}
function XYZarray(src) {
var _local1 = src;
var _local2 = this;
_local2[0] = _local1.x;
_local2[1] = _local1.y;
_local2[2] = _local1.z;
}
cursor.prototype.update = function (path, ylimit) {
var _local1 = this;
var _local2 = path;
_local1.vy = _local2.form._ymouse;
_local1.vx = _local2.form._xmouse;
if (_local1.vy > ylimit) {
_local1.state = 0;
var oz = _local2.pz;
var _local3 = ((scale * _local2.perspex) * (-oz)) / _local1.vy;
if (_local3 > 0) {
_local1.py = _local3;
_local1.px = ((_local3 / _local2.perspex) * _local1.vx) / scale;
_local1.pz = oz;
} else {
_local1.py = 99999 /* 0x01869F */;
_local1.px = ((_local3 / _local2.perspex) * _local1.vx) / scale;
_local1.pz = oz;
}
} else {
_local1.state = 1;
_local1.px = filmspace.px;
_local1.py = filmspace.py;
_local1.pz = filmspace.pz;
}
};
Point = function (p, x, y, z) {
var _local1 = this;
_local1.register(p);
if (x != undefined) {
_local1.xi = (_local1.x = x);
_local1.yi = (_local1.y = y);
_local1.zi = (_local1.z = z);
}
};
Point.prototype.attachTo = function (path) {
this.parent = path;
};
Point.prototype.XYZ = function (a, b, c) {
var _local1 = this;
_local1.x = a;
_local1.y = b;
_local1.z = c;
};
Point.prototype.iXYZ = function (a, b, c) {
var _local1 = this;
_local1.ix = a;
_local1.iy = b;
_local1.iz = c;
};
Point.prototype.zero = function () {
this.xyz(0, 0, 0);
};
Part = function (p, s, colr) {
if (p) {
this.register("Part", p, s);
}
if (colr != unefined) {
this.setColor(colr);
}
};
Part.prototype = new Point();
Part.prototype.makeForm = function (name, base, level) {
if (level == undefined) {
level = this.id;
}
base.form.createEmptyMovieClip((name + "F") + this.id, level);
this.form = eval ((((base.form + ".") + name) + "F") + this.id);
};
Part.prototype.makeShadow = function (name, base, level) {
if (level == undefined) {
level = this.id;
}
if (base.shadow != undefined) {
path = base.shadow;
} else {
path = this.form;
}
path.createEmptyMovieClip((name + "S") + this.id, level);
this.shadow = eval ((((path + ".") + name) + "S") + this.id);
};
Part.prototype.appear = function () {
this.form._visible = 1;
this.shadow._visible = 1;
};
Part.prototype.disappear = function () {
this.form._visible = 0;
this.shadow._visible = 0;
};
being.prototype = new Part();
Part.prototype.register = function (name, p, shadow, formBase) {
var _local1 = this;
var _local2 = formBase;
_local1.parent = p;
_local1.home = _local1.parent.home;
_local1.id = idCount();
if (_local2 == undefined) {
_local2 = p;
}
_local1.makeForm(name, _local2);
if ((shadow == 1) or (shadow == -1)) {
_local1.makeShadow(name, _local2);
} else {
_local1.shadow = 0;
}
_local1.home.registry.push(_local1);
};
Point.prototype.register = function (p) {
var _local1 = this;
_local1.parent = p;
_local1.home = _local1.parent.home;
_local1.id = idCount();
_local1.home.registry.push(_local1);
};
idCounter = 0;
Part.prototype.celBatch = function (nc, nf, shad) {
this.currentCel = 0;
this.cels = new Array();
n = 0;
while (n < nc) {
this.form.createEmptyMovieClip("cel" + n, 1000 + n);
var path = eval ("this.form.cel" + n);
if (shad) {
this.shadow.createEmptyMovieClip("cel" + n, 1000 + n);
path.shadow = eval ("this.shadow.cel" + n);
}
this.cels[n] = path;
m = 0;
while (m < nf) {
path.createEmptyMovieClip("subcel" + m, m);
m++;
}
n++;
}
};
Point.prototype.iFollow = function (target, number) {
var _local1 = this;
_local1.recorder = new Object();
_local1.recorder.src = target;
_local1.recorder.steps = number;
_local1.recorder.states = new Array();
};
Point.prototype.Follow = function (xoffset, zoffset) {
var _local1 = this;
trace("follow");
var _local2 = _local1.recorder.src;
_local1.recorder.states.splice(0, 0, new Array(_local2.px, _local2.py, _local2.pz, _local2.face, _local2.v, _local2.turn));
_local2 = _local1.recorder.states[_local1.recorder.states.length - 1];
_local1.face = _local2[3];
_local1.px = _local2[0] + (xoffset * cos(_local1.face));
_local1.py = _local2[1] + (xoffset * sin(_local1.face));
_local1.pz = _local2[2] + zoffset;
_local1.v = _local2[4];
_local1.turn = _local2[5];
_local1.recorder.states.splice(_local1.recorder.steps, 1);
};
DoubleEase = function (num, max) {
return((1 - cos((num / max) * PI)) / 2);
};
Point.prototype.Locate = function () {
var _local1 = this;
_local1.px = _local1.x + _local1.parent.px;
_local1.py = _local1.y + _local1.parent.py;
_local1.pz = _local1.z + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
};
Point.prototype.LocateRote = function (rote) {
var _local1 = this;
var _local2 = sin(rote);
var _local3 = cos(rote);
_local1.px = ((_local1.x * _local3) - (_local1.y * _local2)) + _local1.parent.px;
_local1.py = ((_local1.y * _local3) + (_local1.x * _local2)) + _local1.parent.py;
_local1.pz = _local1.z + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
};
Point.prototype.LocateRoteTilt = function (rote, tilt) {
var _local1 = this;
var _local3 = rote;
var _local2 = (_local1.x * cos(tilt)) - (_local1.z * sin(tilt));
var z2 = ((_local1.z * cos(tilt)) + (_local1.x * sin(tilt)));
_local1.px = ((_local2 * cos(_local3)) - (_local1.y * sin(_local3))) + _local1.parent.px;
_local1.py = ((_local1.y * cos(_local3)) + (_local2 * sin(_local3))) + _local1.parent.py;
_local1.pz = z2 + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
};
Point.prototype.LocateRoteYaw = function (rote, yaw) {
var _local1 = this;
var _local3 = rote;
var _local2 = (_local1.y * cos(yaw)) - (_local1.z * sin(yaw));
var z2 = ((_local1.z * cos(yaw)) + (_local1.y * sin(yaw)));
_local1.px = ((_local1.x * cos(_local3)) - (_local2 * sin(_local3))) + _local1.parent.px;
_local1.py = ((_local2 * cos(_local3)) + (_local1.x * sin(_local3))) + _local1.parent.py;
_local1.pz = z2 + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
};
Point.prototype.LocateRoteTiltYaw = function (rote, tilt, yaw) {
var _local1 = this;
var _local2 = (_local1.y * cos(yaw)) - (_local1.z * sin(yaw));
var z2 = ((_local1.z * cos(yaw)) + (_local1.y * sin(yaw)));
var _local3 = (_local1.x * cos(tilt)) - (z2 * sin(tilt));
var z3 = ((z2 * cos(tilt)) + (_local1.x * sin(tilt)));
_local1.px = ((_local3 * cos(rote)) - (_local2 * sin(rote))) + _local1.parent.px;
_local1.py = ((_local2 * cos(rote)) + (_local3 * sin(rote))) + _local1.parent.py;
_local1.pz = z3 + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
};
Point.prototype.ProjectionData = function () {
var _local1 = this;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
};
Point.prototype.LocateRoteSrc = function (src) {
var _local1 = this;
var _local2 = src;
_local1.px = ((_local1.x * _local2.cosrote) - (_local1.y * _local2.sinrote)) + _local1.parent.px;
_local1.py = ((_local1.y * _local2.cosrote) + (_local1.x * _local2.sinrote)) + _local1.parent.py;
_local1.pz = _local1.z + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
};
Point.prototype.LocateRoteYawSrc = function (pts) {
var _local2 = this;
var _local3 = pts.length;
n = 0;
while (n < _local3) {
var _local1 = pts[n];
_local1.px = ((_local1.x * _local2.cosrote) - (((_local1.y * _local2.cosyaw) - (_local1.z * _local2.sinyaw)) * _local2.sinrote)) + _local1.parent.px;
_local1.py = ((((_local1.y * _local2.cosyaw) - (_local1.z * _local2.sinyaw)) * _local2.cosrote) + (_local1.x * _local2.sinrote)) + _local1.parent.py;
_local1.pz = ((_local1.z * _local2.cosyaw) + (_local1.y * _local2.sinyaw)) + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
n++;
}
};
Point.prototype.LocateRoteTiltSrc = function (pts) {
var _local2 = this;
var _local3 = pts.length;
n = 0;
while (n < _local3) {
var _local1 = pts[n];
_local1.px = ((((_local1.x * _local2.costilt) - (_local1.z * _local2.sintilt)) * _local2.cosrote) - (_local1.y * _local2.sinrote)) + _local1.parent.px;
_local1.py = ((_local1.y * _local2.cosrote) + (((_local1.x * _local2.costilt) - (_local1.z * _local2.sintilt)) * _local2.sinrote)) + _local1.parent.py;
_local1.pz = ((_local1.z * _local2.costilt) + (_local1.x * _local2.sintilt)) + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
n++;
}
};
Point.prototype.LocateRoteTiltYawSrc = function (pts) {
var _local2 = this;
var L = pts.length;
n = 0;
while (n < L) {
var _local1 = pts[n];
var _local3 = (_local1.y * _local2.cosYaw) - (_local1.z * _local2.sinyaw);
var z2 = ((_local1.z * _local2.cosYaw) + (_local1.y * _local2.sinyaw));
var x2 = ((_local1.x * _local2.costilt) - (z2 * _local2.sinTilt));
var z3 = ((z2 * _local2.costilt) + (_local1.x * _local2.sinTilt));
_local1.px = ((x2 * _local2.cosRote) - (_local3 * _local2.sinRote)) + _local1.parent.px;
_local1.py = ((_local3 * _local2.cosRote) + (x2 * _local2.sinRote)) + _local1.parent.py;
_local1.pz = z3 + _local1.parent.pz;
_local1.depth = filmSpace.perspex / _local1.py;
_local1.vx = _local1.px * (_local1.depth * 10);
_local1.vy = (-_local1.pz) * (_local1.depth * 10);
_local1.sc = 100 * (_local1.depth * 10);
_local1.vys = (-filmSpace.pz) * (_local1.depth * 10);
_local1.sq = filmSpace.pz / _local1.py;
n++;
}
};
Point.prototype.roteSet = function (rote) {
this.cosRote = cos(rote);
this.sinRote = sin(rote);
};
Point.prototype.yawSet = function (yaw) {
this.cosYaw = cos(yaw);
this.sinYaw = sin(yaw);
};
Point.prototype.tiltSet = function (tilt) {
this.cosTilt = cos(tilt);
this.sinTilt = sin(tilt);
};
Part.prototype.angleSet = function (rote, tilt, yaw) {
var _local1 = this;
var _local2 = rote;
var _local3 = tilt;
_local1.rote = _local2;
_local1.tilt = _local3;
_local1.yaw = yaw;
_local1.cosRote = cos(_local2);
_local1.sinRote = sin(_local2);
_local1.cosYaw = cos(yaw);
_local1.sinYaw = sin(yaw);
_local1.cosTilt = cos(_local3);
_local1.sinTilt = sin(_local3);
};
XYZ.prototype = new Array();
Part.prototype.Place = function (x, y, xs, ys) {
var _local1 = this;
_local1.form._x = x;
_local1.form._y = y;
if (xs != undefined) {
_local1.form._xscale = 100 * xs;
}
if (ys != undefined) {
_local1.form._yscale = 100 * ys;
}
};
Point.prototype.FullMatch = function (src) {
var _local1 = src;
var _local2 = this;
_local2.px = _local1.px;
_local2.py = _local1.py;
_local2.pz = _local1.pz;
_local2.depth = _local1.depth;
_local2.sc = _local1.sc;
_local2.vx = _local1.vx;
_local2.vy = _local1.vy;
_local2.vys = _local1.vys;
_local2.sq = _local1.sq;
};
Point.prototype.drag = function (path) {
var _local1 = path;
var _local2 = this;
_local1.form._x = _local2.vx;
_local1.form._y = _local2.vy;
_local1.form._xscale = _local2.sc;
_local1.form._yscale = _local2.sc;
};
Point.prototype.positionMatch = function (path) {
var _local1 = path;
var _local2 = this;
_local2.form._x = _local1.form._x;
_local2.form._y = _local1.form._y;
_local2.form._xscale = _local1.form._xscale;
_local2.form._yscale = _local1.form._yscale;
_local2.form._rotation = _local1.form._rotation;
};
Point.prototype.XYZmatch = function (src) {
var _local1 = src;
var _local2 = this;
_local2.x = _local1.x;
_local2.y = _local1.y;
_local2.z = _local1.z;
};
Point.prototype.iXYZmatch = function (src) {
var _local1 = src;
var _local2 = this;
_local2.ix = _local1.ix;
_local2.iy = _local1.iy;
_local2.iz = _local1.iz;
};
Point.prototype.XYZcapture = function () {
var _local1 = this;
_local1.xi = _local1.x;
_local1.yi = _local1.y;
_local1.zi = _local1.z;
};
Part.prototype.AssignColor = function (num, path) {
this.colr = new Color(path);
this.colr.setRGB(Palette[num].hex);
};
Part.prototype.setColor = function (colr) {
this.assignColor(colr, this.form);
};
Part.prototype.iColorBlend = function (colr1, colr2) {
this.colors = new Array(Palette[colr1], Palette[colr2]);
};
Part.prototype.ColorBlend = function (frac, colorPair) {
var _local2 = colorPair;
if (_local2 == undefined) {
_local2 = this.colors;
}
if (frac < 0) {
frac = 0;
} else if (frac > 1) {
frac = 1;
}
this.colorFrac = frac;
var num = (100 * (1 - frac));
var _local1 = new Object();
var _local3 = frac;
_local1.ra = (_local1.ga = (_local1.ba = 0));
_local1.rb = (_local2[1].rgb[0] * _local3) + (_local2[0].rgb[0] * (1 - _local3));
_local1.gb = (_local2[1].rgb[1] * _local3) + (_local2[0].rgb[1] * (1 - _local3));
_local1.bb = (_local2[1].rgb[2] * _local3) + (_local2[0].rgb[2] * (1 - _local3));
this.colr.setTransform(_local1);
};
Part.prototype.iColorShade = function (num) {
this.setColor(0);
this.shadecolor = Palette[num];
};
Part.prototype.ColorShade = function (frac, colr) {
var _local2 = frac;
var _local3 = this;
if (colr != undefined) {
_local3.shadecolor = Palette[colr];
}
if (_local2 < 0) {
_local2 = 0;
} else if (_local2 > 1) {
_local2 = 1;
}
var num = (100 * (1 - _local2));
var _local1 = new Object();
var num2 = _local2;
_local1.ra = (_local1.ga = (_local1.ba = num));
_local1.rb = _local3.shadecolor.rgb[0] * num2;
_local1.gb = _local3.shadecolor.rgb[1] * num2;
_local1.bb = _local3.shadecolor.rgb[2] * num2;
_local3.colr.setTransform(_local1);
};
Part.prototype.Position = function () {
var _local1 = this;
_local1.form._x = _local1.vx;
_local1.form._y = _local1.vy;
_local1.form._xscale = (_local1.form._yscale = _local1.sc);
};
Part.prototype.PositionShadow = function () {
var _local1 = this;
_local1.shadow._x = _local1.vx;
_local1.shadow._y = _local1.vys;
_local1.shadow._xscale = _local1.sc;
_local1.shadow._yscale = _local1.sc * _local1.sq;
};
Part.prototype.PositionShadowSrc = function (src) {
var _local1 = src;
var _local2 = this;
_local2.shadow._x = _local1.vx;
_local2.shadow._y = _local1.vys;
_local2.shadow._xscale = _local1.sc;
_local2.shadow._yscale = _local1.sc * _local1.sq;
};
Part.prototype.PositionFull = function () {
this.position();
this.positionShadow();
};
Part.prototype.PositionSimple = function () {
var _local1 = this;
_local1.form._x = _local1.vx;
_local1.form._y = _local1.vy;
};
Part.prototype.PositionShadowSimple = function () {
var _local1 = this;
_local1.shadow._x = _local1.px - _local1.parent.px;
_local1.shadow._y = _local1.py - _local1.parent.py;
};
Part.prototype.setDepth = function (src) {
var _local1 = this;
if (src != undefined) {
_local1.form.swapDepths(src.depth * 1000000);
} else {
_local1.form.swapDepths(_local1.depth * 1000000);
}
};
Part.prototype.setDepthNum = function (num) {
this.form.swapDepths(num * 1000000);
};
Part.prototype.fore = function (src, int) {
var _local1 = int;
if (_local1 == undefined) {
_local1 = 1;
}
this.form.swapDepths((src.depth * 1000000) + _local1);
};
Part.prototype.aft = function (src, int) {
var _local1 = int;
if (_local1 == undefined) {
_local1 = 1;
}
this.form.swapDepths((src.depth * 1000000) - _local1);
};
Cell = function (avatar, level, shadowColr) {
var _local1 = this;
_local1.home = _local1;
_local1.parent = _local1;
_local1.registry = new Array();
_local1.level = level;
_local1.perspex = FilmSpace.perspex;
_local1.px = filmspace.px;
_local1.py = filmspace.py;
_local1.pz = filmspace.pz;
_local1.build(shadowColr);
_local1.avatar = new Avatar(_local1);
_local1.avatar.zero();
_local1.avatar.locate();
_local1.avatar.initialize(q);
_local1.avatar.enter();
};
Cell.prototype = new Part();
Cell.prototype.build = function (shadowColr) {
var _local1 = this;
_local1.makeForm("Cell" + _local1.id, _root, _local1.level + 2);
_local1.makeShadow("Cell" + _local1.id, _root, _local1.level + 1);
_local1.form._xscale = (_local1.form._yscale = 9);
_local1.form._x = layout.ox;
_local1.form._y = layout.oy + filmspace.offset;
_local1.assignColor(shadowColr, _local1.shadow);
};
function Square(p, unit, colr, shadow, xoff, yoff) {
var _local1 = this;
var _local2 = shadow;
_local1.register("square", p, _local2);
_local1.unit = unit;
_local1.setColor(colr);
_local1.Build(_local1.form, xoff, yoff);
if (_local2) {
_local1.Build(_local2, xoff, yoff);
}
}
function Side(p, otrside, pointSet, formBase, shadow) {
var _local1 = this;
_local1.superclass = shape;
_local1.superclass(p, 0, otrside, pointSet, shadow, formBase);
if (otrside != null) {
_local1.otr = 1;
}
}
function Loopset(p, src) {
var _local1 = this;
var _local2 = p;
_local1.pts = new Array();
_local1.cpts = new Array();
var _local3 = src.u.length;
n = 0;
while (n < _local3) {
_local1.pts[n] = new Point(_local2);
_local1.cpts[n] = new Point(_local2);
n++;
}
_local2.pointset = _local1.pts;
}
function Bridge(p, path, pt, lnwt, colr, shadow, cvpoint) {
var _local1 = this;
var _local2 = shadow;
_local1.register("Bridge", p, _local2);
_local1.path = path;
_local1.pt = pt;
_local1.lw = lnwt;
_local1.Build(_local2);
_local1.setColor(colr);
if (cvpoint != undefined) {
_local1.cvpoint = cvpoint;
_local1.bridgeBasic = _local1.bridgeCurved;
} else {
_local1.bridgeBasic = _local1.bridgeSimple;
}
if (_local2 == 1) {
_local1.draw = _local1.bridgeFull;
} else {
_local1.draw = _local1.bridgeBasic;
}
}
function Rectangle(p, colr) {
var _local1 = this;
_local1.register("Rectangle", p);
_local1.setColor(colr);
_local1.Build(_local1.form);
}
Triangle = function (p, lngth, wdth, colr, shadow) {
var _local1 = this;
var _local2 = shadow;
_local1.register("Triangle", p, _local2);
_local1.setColor(colr);
_local1.basicPosition = Ybranch(_local2, _local1.positionFull, _local1.position, _local1.position);
_local1.render(_local1.form, lngth, wdth);
if (_local2) {
_local1.shadow.createEmptyMovieClip("subshadow", 1);
_local1.render(_local1.shadow.subshadow, lngth, wdth);
}
};
Triangle.pType(Part);
Triangle.prototype.Draw = this.basicPosition();
Triangle.prototype.Render = function (path, lngth, wdth) {
var _local1 = path;
var _local2 = wdth;
var _local3 = lngth;
_local1.beginFill(16777215);
_local1.moveTo(-_local3, -_local2);
_local1.lineTo(-_local3, _local2);
_local1.lineTo(0, 0);
_local1.lineTo(-_local3, -_local2);
};
Square.prototype = new Part();
Square.prototype.draw = this.autoPlace();
Square.prototype.Build = function (path, xoff, yoff) {
var _local1 = this;
var _local2 = path;
xo = xoff * _local1.unit;
yo = yoff * _local1.unit;
_local2.clear();
_local2.beginFill(16777215);
_local2.moveTo((_local1.unit / 2) + xo, (_local1.unit / 2) + yo);
_local2.lineTo(((-_local1.unit) / 2) + xo, (_local1.unit / 2) + yo);
_local2.lineTo(((-_local1.unit) / 2) + xo, ((-_local1.unit) / 2) + yo);
_local2.lineTo((_local1.unit / 2) + xo, ((-_local1.unit) / 2) + yo);
_local2.lineTo((_local1.unit / 2) + xo, (_local1.unit / 2) + yo);
};
Shape = function (p, colr1, colr2, pointSet, shadow, formBase) {
var _local1 = this;
_local1.register("Shape", p, shadow, formBase);
_local1.sideface = (_local1.iSideface = 1);
_local1.kolors = new Array(colr1, colr2);
_local1.setColor(colr1);
_local1.pointSet = pointSet;
};
Shape.pType(Part);
Shape.prototype.Draw = function () {
var _local1 = this;
_local1.form.clear();
_local1.form.beginFill(16777215);
_local1.drawCircuit(_local1.pointSet);
if (_local1.sideCheck() != _local1.isideFace) {
_local1.isideFace = _local1.sideface;
_local1.setColor(_local1.kolors[(_local1.sideFace / 2) + 0.5]);
}
if (_local1.shadow) {
_local1.shadow.clear();
_local1.shadow.beginFill(16777215);
_local1.drawShadowCircuit(_local1.pointSet);
}
};
ThickShape = function (p, lnwt, colr, pointSet, shadow, formBase) {
var _local1 = this;
_local1.register("Shape", p, shadow, formBase);
_local1.weight = lnwt;
_local1.setColor(colr);
_local1.pointSet = pointSet;
};
ThickShape.pType(Shape);
ThickShape.prototype.Draw = function () {
var _local1 = this;
_local1.form.clear();
_local1.form.lineStyle((_local1.weight * _local1.pointset[0].depth) * scale, 16777215);
_local1.form.beginFill(16777215);
_local1.drawCircuit(_local1.pointSet);
if (_local1.shadow) {
_local1.shadow.clear();
_local1.shadow.beginFill(16777215);
_local1.drawShadowCircuit(_local1.pointSet);
}
};
Shape.prototype.setDepth = function () {
var _local1 = this;
_local1.depth = (_local1.pointset[0].depth + _local1.pointset[2].depth) / 2;
_local1.setDepthNum(_local1.depth);
};
Side.pType(Shape);
Side.prototype.Draw = function () {
var _local1 = this;
_local1.form.clear();
if ((_local1.sideCheck() == 1) or (_local1.otr == 1)) {
_local1.form.beginFill(16777215);
_local1.DrawCircuit(_local1.pointset);
}
if (_local1.shadow != undefined) {
_local1.shadow.clear();
_local1.shadow.beginFill(16777215);
_local1.drawShadowCircuit(_local1.pointSet);
}
};
Side.prototype.Draw2 = function () {
var _local1 = this;
_local1.form.clear();
_local1.form.beginFill(16777215);
_local1.DrawCircuit(_local1.pointset);
if (_local1.shadow) {
_local1.shadow.clear();
_local1.shadow.beginFill(16777215);
_local1.drawShadowCircuit(_local1.pointSet);
}
};
Side.prototype.Blend = function () {
var _local1 = this;
var _local2 = (_local1.pointSet[0].pz - _local1.pointSet[2].pz) / (_local1.unit * 2);
_local1.ColorBlend(_local2);
};
Shape.prototype.sideCheck = function () {
var _local1 = this;
var _local2 = atan2(_local1.pointSet[1].vy - _local1.pointSet[0].vy, _local1.pointSet[1].vx - _local1.pointSet[0].vx) - atan2(_local1.pointSet[2].vy - _local1.pointSet[0].vy, _local1.pointSet[2].vx - _local1.pointSet[0].vx);
if (sin(_local2) > 0) {
_local1.sideface = 1;
} else {
_local1.sideface = -1;
}
return(_local1.sideface);
};
Part.prototype.drawCircuit = function (pointSet) {
var _local2 = this;
_local2.depth = 0;
var _local3 = _local2.pointSet.length;
var _local1 = _local2.pointSet[_local3 - 1];
_local2.form.moveTo(_local1.vx, _local1.vy);
n = 0;
while (n < _local3) {
_local1 = _local2.pointSet[n];
_local2.form.lineTo(_local1.vx, _local1.vy);
_local2.depth = _local2.depth + (_local1.depth / _local3);
n++;
}
};
Part.prototype.drawShadowCircuit = function (pointSet) {
var _local2 = this;
var _local3 = _local2.pointSet.length;
var _local1 = _local2.pointSet[_local3 - 1];
_local2.shadow.moveTo(_local1.vx, _local1.vys);
n = 0;
while (n < _local3) {
_local1 = _local2.pointSet[n];
_local2.shadow.lineTo(_local1.vx, _local1.vys);
n++;
}
};
SimpleLine = function (p, p1, p2, weight, colr, shadow) {
var _local1 = this;
_local1.register("Line", p, shadow);
_local1.p1 = p1;
_local1.p2 = p2;
_local1.weight = weight;
_local1.setColor(colr);
};
SimpleLine.pType(Part);
SimpleLine.prototype.draw = function () {
var _local1 = this;
_local1.form.clear();
_local1.form.lineStyle(((_local1.weight * scale) * (_local1.p1.depth + _local1.p2.depth)) / 2, 16777215);
_local1.form.moveTo(_local1.p1.vx, _local1.p1.vy);
_local1.form.lineTo(_local1.p2.vx, _local1.p2.vy);
};
Line = function (p, colr) {
this.register("Line", p, shadow);
this.setColor(colr);
};
Line.pType(Part);
CurvedLine = function (p, p1, cvpt, p2, weight, colr, shadow) {
var _local1 = this;
_local1.register("Line", p, shadow);
_local1.p1 = p1;
_local1.p2 = p2;
_local1.cvpt = cvpt;
_local1.weight = weight;
_local1.setColor(colr);
};
CurvedLine.pType(Part);
CurvedLine.prototype.draw = function () {
var _local1 = this;
_local1.form.clear();
_local1.form.lineStyle(((_local1.weight * scale) * (_local1.p1.depth + _local1.p2.depth)) / 2, 16777215);
_local1.form.moveTo(_local1.p1.vx, _local1.p1.vy);
_local1.form.curveTo(_local1.cvpt.vx, _local1.cvpt.vy, _local1.p2.vx, _local1.p2.vy);
};
Square.prototype.connekt = function (path1, path2, shadow) {
var _local1 = this;
_local1.form._x = _local1.parent.vx;
_local1.form._y = _local1.parent.vy;
var _local3 = path1.vx - path2.vx;
var _local2 = path1.vy - path2.vy;
_local1.form._rotation = atan2(_local2, _local3) / (PI / 180);
_local1.form._xscale = (sqrt((_local3 * _local3) + (_local2 * _local2)) * scale) * 10;
_local1.form._yscale = (_local1.parent.sc * _local1.parent.r) * 2;
if (shadow) {
_local3 = path1.shadow._x - path2.shadow._x;
_local2 = path1.shadow._y - path2.shadow._y;
_local1.shadow._rotation = atan2(_local2, _local3) / (PI / 180);
_local1.shadow._xscale = (sqrt((_local3 * _local3) + (_local2 * _local2)) * 10) * _local1.parent.r;
_local1.shadow._yscale = ((_local1.parent.r * 2) * scale) * 10;
}
};
Circle = function (p, r, colr, shadow, formbase, kind) {
var _local1 = this;
var _local2 = kind;
var _local3 = shadow;
_local1.register("Circle", p, _local3, formbase);
_local1.r = r;
_local1.setColor(colr);
if (_local2 == undefined) {
_local2 = "circle";
}
_local1.form.attachMovie(_local2, "shape", 1);
if (abs(_local3) == 1) {
_local1.shadow.attachMovie(_local2, "shape", 1);
}
if (_local3 == 1) {
_local1.draw = (_local1.CircleDraw = _local1.fullDraw);
} else {
_local1.draw = (_local1.CircleDraw = _local1.SimpleDraw);
}
_local1.normal = new Point(_local1, 1);
};
Circle.pType(Part);
Circle.prototype.extrabuild = function (shadow) {
var _local1 = this;
if (shadow) {
_local1.shadow.clear();
_local1.shadow.createEmptyMovieClip("subshadow", 1);
_local1.render(_local1.shadow.subshadow);
}
};
Circle.prototype.SimpleDraw = function () {
var _local1 = this;
_local1.form._x = _local1.vx;
_local1.form._y = _local1.vy;
_local1.form._xscale = (_local1.form._yscale = (_local1.sc * _local1.r) / scale);
};
Circle.prototype.FullDraw = function () {
var _local1 = this;
_local1.form._x = _local1.vx;
_local1.form._y = _local1.vy;
_local1.form._xscale = (_local1.form._yscale = (_local1.sc * _local1.r) / scale);
_local1.shadowDraw(src);
};
Circle.prototype.ShadowDraw = function () {
var _local1 = this;
_local1.shadow._x = _local1.vx;
_local1.shadow._y = _local1.vys;
_local1.shadow._xscale = (_local1.sc * _local1.r) / scale;
_local1.shadow._yscale = ((_local1.sc * _local1.sq) * _local1.r) / scale;
};
Circle.prototype.ShadowOff = function () {
var _local1 = this;
_local1.shadow._visible = 0;
_local1.draw = _local1.SimpleDraw;
};
Circle.prototype.ShadowOn = function () {
var _local1 = this;
_local1.shadow._visible = 1;
_local1.draw = _local1.FullDraw;
};
Circle.prototype.sizeRatio = function () {
return(this.form._xscale / this.form._yscale);
};
HalfCircle = function (p, r, colr, shadow) {
var _local1 = this;
var _local2 = shadow;
_local1.register("HalfCircle", p, _local2);
_local1.r = r;
_local1.setColor(colr);
_local1.src = Circle6;
_local1.render(_local1.form);
trace(_local1.shadow);
if (_local2 == 1) {
_local1.render(_local1.shadow, ox, oy);
_local1.draw = (_local1.CircleDraw = _local1.fullDraw);
} else if (_local2 == -1) {
_local1.render(_local1.shadow, ox, oy);
_local1.draw = (_local1.CircleDraw = _local1.SimpleDraw);
} else {
_local1.draw = (_local1.CircleDraw = _local1.SimpleDraw);
}
};
HalfCircle.pType(Circle);
CircleData = function (n, rc) {
var _local2 = this;
_local2.u = new Array();
_local2.v = new Array();
_local2.uc = new Array();
_local2.vc = new Array();
var k = ((2 * PI) / n);
a = 0;
while (a < n) {
var _local1 = k * a;
var _local3 = _local1 - (k / 2);
_local2.uc[a] = rc * sin(_local3);
_local2.vc[a] = rc * cos(_local3);
_local2.u[a] = sin(_local1);
_local2.v[a] = cos(_local1);
a++;
}
};
Circle.prototype.render = (Part.prototype.renderCircle = function (path, ox, oy) {
var _local1 = path;
var _local2 = oy;
var _local3 = ox;
_local1.attachMovie("circle", "shape", 1);
_local3 = (10 * _local3) / this.r;
_local2 = (10 * _local2) / this.r;
_local1.shape._x = _local3;
_local1.shape._y = _local2;
});
HalfCircle.prototype.render = (part.prototype.RenderHalfCircle = function (path) {
path.attachMovie("halfcircle", "shape", 1);
});
Oval = function (p, r, YS, colr, shadow) {
var _local1 = this;
_local1.superClass = Circle;
_local1.superClass(p, r, colr, shadow);
_local1.r = r;
_local1.YS = YS;
_local1.extrabuild(shadow);
_local1.draw = _local1.OvalDraw;
};
Oval.pType(Circle);
Circle.prototype.OvalDraw = function () {
var _local1 = this;
_local1.CircleDraw();
_local1.normal.locateRoteTilt(_local1.rote, _local1.tilt);
_local1.Squash(_local1.rote, _local1.tilt, _local1.normal);
};
HalfOval = function (p, r, YS, colr, shadow) {
var _local1 = this;
_local1.superClass = HalfCircle;
_local1.superClass(p, r, colr, shadow);
_local1.r = r;
_local1.YS = YS;
_local1.extrabuild(shadow);
_local1.draw = function (face, tilt) {
var _local1 = this;
_local1.CircleDraw();
_local1.squash(face, tilt, _local1.parent.normal);
};
};
HalfOval.pType(HalfCircle);
Circle.prototype.Squash = (HalfOval.prototype.Squash = function (face, tilt, nrml) {
var _local1 = this;
var _local2 = nrml;
if (_local2 == undefined) {
_local2 = _local1.normal;
}
var ex = ((_local2.vx - _local1.vx) / ((_local1.depth + _local2.depth) / 2));
var _local3 = (_local2.vy - _local1.vy) / ((_local1.depth + _local2.depth) / 2);
var ratio = (sqrt((ex * ex) + (_local3 * _local3)) / scale);
_local1.form._rotation = atan2(_local3, ex) / (PI / 180);
_local1.form._xscale = _local1.form._xscale * (1 + ((ratio * ratio) * (_local1.YS - 1)));
if (_local1.shadow) {
_local1.shadow.subshadow._xscale = ((sin(tilt) * sin(tilt)) * 100) + (((cos(tilt) * cos(tilt)) * 100) * _local1.YS);
_local1.shadow.subshadow._rotation = (face / (PI / 180)) + 180;
}
});
Circle.prototype.altitude = function (tilt) {
var _local1 = tilt;
return(this.r * ((cos(_local1) * cos(_local1)) + ((this.YS * sin(_local1)) * sin(_local1))));
};
Disc = function (p, r, colr1, colr2, shadow) {
var _local1 = this;
_local1.superClass = Circle;
_local1.superClass(p, r, colr1, shadow);
if (colr2 != null) {
_local1.colors = new Array(colr1, colr2);
_local1.sideFace = -1;
_local1.setColor(_local1.colors[1]);
}
_local1.extrabuild(shadow);
_local1.r = r;
_local1.draw = function (face, tilt) {
var _local1 = this;
_local1.CircleDraw();
_local1.normal.locateRoteTilt(face, tilt);
_local1.squash(face, tilt, _local1.normal);
if (_local1.colors) {
_local1.sideCheck();
}
};
};
Disc.pType(Circle);
Disc.prototype.squash = function (face, tilt, normal) {
var _local1 = this;
var _local2 = normal;
if (_local2 == undefined) {
_local2 = _local1.normal;
}
var d1 = sqrt(((_local2.px * _local2.px) + (_local2.py * _local2.py)) + (_local2.pz * _local2.pz));
var _local3 = sqrt(((_local1.px * _local1.px) + (_local1.py * _local1.py)) + (_local1.pz * _local1.pz));
_local1.form._rotation = atan2(_local2.vy - _local1.vy, _local2.vx - _local1.vx) / (PI / 180);
_local1.squish = d1 - _local3;
_local1.form._xscale = _local1.form._xscale * _local1.squish;
if (_local1.shadow) {
_local1.shadow.subshadow._xscale = sin(tilt) * 100;
_local1.shadow.subshadow._yscale = 100;
_local1.shadow.subshadow._rotation = face / (PI / 180);
}
};
Disc.prototype.sideCheck = function () {
var _local1 = this;
if ((_local1.sideFace * _local1.form._xscale) < 0) {
_local1.sideFace = _local1.sideFace * -1;
_local1.setColor(_local1.colors[((-_local1.sideface) / 2) + 0.5]);
}
};
Disc.prototype.mimic = function (path) {
var _local1 = this;
var _local2 = path;
_local1.form._x = _local2.vx;
_local1.form._y = _local2.vy;
_local1.form._yscale = (_local2.sc * _local1.r) / 10;
_local1.form._xscale = ((_local2.sc * _local2.squish) * _local1.r) / 10;
_local1.form._rotation = _local2.form._rotation;
};
Circle.prototype.OvalDiscDraw = function (face, tilt) {
var _local1 = this;
_local1.CircleDraw();
_local1.normal.locateRoteTilt(face, tilt);
_local1.OvalDiscSquash(face, tilt, _local1.normal);
};
Circle.prototype.OvalDiscSquash = function (face, tilt, nrml) {
var _local1 = this;
var _local2 = nrml;
var _local3 = tilt;
if (_local2 == undefined) {
_local2 = _local1.normal;
}
o_xscale = _local1.YS;
var d1 = sqrt(((_local2.px * _local2.px) + (_local2.py * _local2.py)) + (_local2.pz * _local2.pz));
var d2 = sqrt(((_local1.px * _local1.px) + (_local1.py * _local1.py)) + (_local1.pz * _local1.pz));
_local1.form._rotation = atan2(_local2.vy - _local1.vy, _local2.vx - _local1.vx) / (PI / 180);
_local1.squish = _local1.sq;
d_xscale = abs(_local1.squish);
var fac = (1 - _local1.YS);
_local1.form._rotation = 90;
var xs = (((abs(d_xscale) * cos((_local1.YS * PI) / 2)) * cos((_local1.YS * PI) / 2)) + (abs(o_xscale) * abs(cos((_local1.squish * PI) / 2))));
_local1.form._xscale = _local1.form._xscale * xs;
trace("sq" + _local1.squish);
trace((abs(d_xscale) * cos((_local1.YS * PI) / 2)) * cos((_local1.YS * PI) / 2));
if (_local1.shadow) {
_local1.shadow.subshadow._xscale = ((sin(_local3) * sin(_local3)) * 100) + (((cos(_local3) * cos(_local3)) * 100) * _local1.YS);
_local1.shadow.subshadow._rotation = (face / (PI / 180)) + 180;
}
};
Loop = function (p, libraryName, radius, lnwt, lncolr, fillcolr) {
var _local1 = this;
_local1.register("Loop", p, shadow);
_local1.r = radius;
_local1.lnwt = lnwt;
_local1.lncolr = _local1.home.Colors[lncolr];
_local1.src = Circle6;
_local1.kind = libraryName;
_local1.fillcolr = _local1.home.Colors[fillcolr];
_local1.build(shadow);
_local1.normal = new Point(_local1, 1);
_local1.render(_local1.form);
};
Loop.prototype = new Part();
Loop.prototype.render = function (path) {
path.attachMovie(this.kind, "shape", 2);
path.shape.stop();
};
Loop.prototype.draw = function (face, tilt) {
var _local1 = this;
_local1.normal.locateRoteTilt(face, tilt);
var _local3 = sqrt((_local1.normal.px * _local1.normal.px) + (_local1.normal.py * _local1.normal.py));
var _local2 = sqrt((_local1.px * _local1.px) + (_local1.py * _local1.py));
_local1.d = sqrt((_local3 * _local3) + (_local1.normal.pz * _local1.normal.pz)) - sqrt((_local2 * _local2) + (_local1.pz * _local1.pz));
var eA = atan2(_local1.normal.vy - _local1.vy, _local1.normal.vx - _local1.vx);
_local1.cel = Math.round(50 * _local1.d);
if (_local1.cel < 0) {
_local1.cel = _local1.cel * -1;
}
_local1.form._rotation = ea / (PI / 180);
_local1.form._x = _local1.vx;
_local1.form._y = _local1.vy;
_local1.form._xscale = (_local1.form._yscale = (_local1.sc / scale) * _local1.r);
_local1.form.shape.gotoAndStop(50 - _local1.cel);
};
Loop.prototype.sideCheck = function () {
var _local1 = this;
_local1.sideface = _local1.d / abs(_local1.d);
return(_local1.sideface);
};
Loop.prototype.sizeRatio = function () {
return(this.cel / 50);
};
Loop.prototype.PlotLoopSimple = function (radius, src, catalog, face) {
var _local1 = src;
var _local3 = radius;
L = _local1.u.length;
n = 0;
while (n < L) {
var pt = catalog.pts[n];
var _local2 = catalog.cpts[n];
pt.vx = (_local1.u[n] * _local3) * cos(face);
pt.vy = _local1.v[n] * _local3;
_local2.vx = (_local1.uc[n] * _local3) * cos(face);
_local2.vy = _local1.vc[n] * _local3;
n++;
}
};
Loop.prototype.PlotLoop = function (radius, src, catalog, rote, tilt, half) {
var _local3 = src;
if (half) {
L = (_local3.u.length / 2) + 1;
} else {
L = _local3.u.length;
}
n = 0;
while (n < L) {
var _local2 = catalog.pts[n];
var _local1 = catalog.cpts[n];
_local2.x = _local3.u[n] * radius;
_local2.y = _local3.v[n] * radius;
_local2.locateRoteTilt(Rote, Tilt);
_local1.x = _local3.uc[n] * radius;
_local1.y = _local3.vc[n] * radius;
_local1.locateRoteTilt(Rote, Tilt);
n++;
}
};
Bridge.prototype = new Part();
Bridge.prototype.Build = function (shadow) {
var _local1 = this;
_local1.render(_local1.form);
if (shadow != 0) {
_local1.render(_local1.shadow);
}
};
Bridge.prototype.BridgeFull = function () {
this.bridgeBasic();
this.BridgeShadow();
};
Bridge.prototype.bridgeSimple = function () {
var _local1 = this;
_local1.tangentFinder(_local1.pt.vx - _local1.path.vx, _local1.pt.vy - _local1.path.vy, ((_local1.path.r - (_local1.lw / 2)) * _local1.path.depth) * scale);
_local1.form.clear();
_local1.form.beginFill(16777215);
if (_local1.lw != 0) {
_local1.form.lineStyle((_local1.lw * _local1.path.depth) * scale, 16777215);
}
_local1.form.moveTo(_local1.pt.vx, _local1.pt.vy);
_local1.form.lineTo(_local1.path.vx + _local1.xt1, _local1.path.vy + _local1.yt1);
_local1.form.lineTo(_local1.path.vx + _local1.xt2, _local1.path.vy + _local1.yt2);
_local1.form.lineTo(_local1.pt.vx, _local1.pt.vy);
};
Bridge.prototype.bridgeShadow = function () {
var _local1 = this;
var _local3 = _local1.path.shadow.subshadow._xscale / _local1.path.shadow.subshadow._yscale;
var dx = (_local1.pt.vx - _local1.path.vx);
var dy = ((_local1.pt.vys - _local1.path.vys) / _local1.path.sq);
_local1.tangentFinder(0, Pyt(dx, dy) / _local3, (_local1.path.r * _local1.path.depth) * scale);
_local1.shadow.clear();
_local1.shadow.beginFill(16777215);
if (_local1.lw != 0) {
_local1.form.lineStyle((_local1.lw * _local1.path.depth) * scale, 16777215);
}
var xo1 = _local1.xt1;
var xo2 = _local1.xt2;
var yo1 = (_local1.yt1 * _local3);
var yo2 = (_local1.yt2 * _local3);
var _local2 = atan2(dy, dx);
_local1.shadow.moveTo(_local1.pt.vx, _local1.pt.vys);
_local1.shadow.lineTo((_local1.path.vx + (xo1 * sin(_local2))) - (yo1 * cos(_local2)), _local1.path.vys + ((((-yo1) * sin(_local2)) - (xo1 * cos(_local2))) * _local1.path.sq));
_local1.shadow.lineTo((_local1.path.vx + (xo2 * sin(_local2))) - (yo2 * cos(_local2)), _local1.path.vys + ((((-yo2) * sin(_local2)) - (xo2 * cos(_local2))) * _local1.path.sq));
_local1.shadow.lineTo(_local1.pt.vx, _local1.pt.vys);
};
Bridge.prototype.bridgeSimpleOval = function (rcheat) {
var _local1 = this;
_local1.form.clear();
var _local3 = _local1.path.sizeRatio();
if ((_local1.pt.r == 0) or (_local1.pt.r == undefined)) {
var d = (Pyt(_local1.pt.vx - _local1.path.vx, _local1.pt.vy - _local1.path.vy) / _local3);
var vr = (((_local1.path.r - (_local1.lw / 2)) * _local1.path.depth) * scale);
if (d > vr) {
_local1.tangentFinder(0, d, vr);
_local1.form.beginFill(16777215);
if (_local1.lw != 0) {
_local1.form.lineStyle((_local1.lw * _local1.path.depth) * scale, 16777215);
}
var xo1 = _local1.xt1;
var xo2 = _local1.xt2;
var yo1 = (_local1.yt1 * _local3);
var yo2 = (_local1.yt2 * _local3);
var _local2 = ((_local1.path.form._rotation * PI) / 180) + PI;
_local1.form.moveTo(_local1.pt.vx, _local1.pt.vy);
_local1.form.lineTo((_local1.path.vx + (xo1 * sin(_local2))) - (yo1 * cos(_local2)), (_local1.path.vy - (yo1 * sin(_local2))) - (xo1 * cos(_local2)));
_local1.form.lineTo((_local1.path.vx + (xo2 * sin(_local2))) - (yo2 * cos(_local2)), (_local1.path.vy - (yo2 * sin(_local2))) - (xo2 * cos(_local2)));
_local1.form.lineTo(_local1.pt.vx, _local1.pt.vy);
}
} else {
var vfac = (_local1.path.r / (_local1.path.r - _local1.pt.r));
var vtx = ((_local1.pt.vx - _local1.path.vx) * vfac);
var vty = ((_local1.pt.vy - _local1.path.vy) * vfac);
var d = (Pyt(vtx, vty) / _local3);
var vr = (((_local1.path.r - (_local1.lw / 2)) * _local1.path.depth) * scale);
if (d > vr) {
_local1.tangentFinder(0, d, vr);
var xo1 = _local1.xt1;
var xo2 = _local1.xt2;
var yo1 = (_local1.yt1 * _local3);
var yo2 = (_local1.yt2 * _local3);
var _local2 = ((_local1.path.form._rotation * PI) / 180) + PI;
var fac2 = _local1.pt.sizeRatio();
if (fac2 == 0) {
var fac2 = 0.001;
}
var d2 = (Pyt(vtx - (_local1.pt.vx - _local1.path.vx), vty - (_local1.pt.vy - _local1.path.vy)) / fac2);
var vr2 = ((abs((_local1.pt.r - (_local1.lw / 2)) + rcheat) * _local1.path.depth) * scale);
_local1.tangentFinder(0, d2, vr2);
var xo1b = _local1.xt1;
var xo2b = _local1.xt2;
var yo1b = (_local1.yt1 * fac2);
var yo2b = (_local1.yt2 * fac2);
var roteb = (((_local1.path.form._rotation * PI) / 180) + PI);
_local1.form.beginFill(16777215);
if (_local1.lw != 0) {
_local1.form.lineStyle((_local1.lw * _local1.path.depth) * scale, 16777215);
}
var ox = ((_local1.pt.vx + (xo1b * sin(_local2))) - (yo1b * cos(_local2)));
var oy = ((_local1.pt.vy - (yo1b * sin(_local2))) - (xo1b * cos(_local2)));
_local1.form.moveTo(ox, oy);
_local1.form.lineTo((_local1.path.vx + (xo1 * sin(_local2))) - (yo1 * cos(_local2)), (_local1.path.vy - (yo1 * sin(_local2))) - (xo1 * cos(_local2)));
_local1.form.lineTo((_local1.path.vx + (xo2 * sin(_local2))) - (yo2 * cos(_local2)), (_local1.path.vy - (yo2 * sin(_local2))) - (xo2 * cos(_local2)));
_local1.form.lineTo((_local1.pt.vx + (xo2b * sin(_local2))) - (yo2b * cos(_local2)), (_local1.pt.vy - (yo2b * sin(_local2))) - (xo2b * cos(_local2)));
_local1.form.lineTo(ox, oy);
}
}
};
Bridge.prototype.bridgeCurved = function () {
var _local1 = this;
_local1.form.clear();
var d1 = Pyt(_local1.path.vx - _local1.pt.vx, _local1.path.vy - _local1.pt.vy);
if ((d1 * scale) > ((_local1.path.r * _local1.path.sc) / scale)) {
var temp = (Pyt(_local1.path.vx - _local1.cvpoint.vx, _local1.path.vy - _local1.cvpoint.vy) / d1);
var _local2 = temp * temp;
if (_local2 > 1) {
_local2 = 1;
}
_local1.tangentFinder(((_local1.cvpoint.vx * _local2) + (_local1.pt.vx * (1 - _local2))) - _local1.path.vx, ((_local1.cvpoint.vy * _local2) + (_local1.pt.vy * (1 - _local2))) - _local1.path.vy, ((_local1.path.r - (_local1.lw / 2)) * _local1.path.depth) * scale);
_local1.form.beginFill(16777215);
if (_local1.lw != 0) {
_local1.form.lineStyle((_local1.lw * _local1.path.depth) * scale, 16777215);
}
var px1 = (_local1.path.vx + _local1.xt1);
var py1 = (_local1.path.vy + _local1.yt1);
var px2 = (_local1.path.vx + _local1.xt2);
var _local3 = _local1.path.vy + _local1.yt2;
_local1.form.moveTo(_local1.pt.vx, _local1.pt.vy);
_local1.form.curveTo((((_local1.cvpoint.vx * _local2) + (((1 - _local2) * (px1 + _local1.pt.vx)) / 2)) + px1) / 2, (((_local1.cvpoint.vy * _local2) + (((1 - _local2) * (py1 + _local1.pt.vy)) / 2)) + py1) / 2, px1, py1);
_local1.form.lineTo(px2, _local3);
_local1.form.curveTo((((_local1.cvpoint.vx * _local2) + (((1 - _local2) * (px2 + _local1.pt.vx)) / 2)) + px2) / 2, (((_local1.cvpoint.vy * _local2) + (((1 - _local2) * (_local3 + _local1.pt.vy)) / 2)) + _local3) / 2, _local1.pt.vx, _local1.pt.vy);
_local1.form.endFill();
}
};
Bridge.prototype.bridgeCurvedOval = function () {
var _local1 = this;
var d1 = Pyt(_local1.path.vx - _local1.pt.vx, _local1.path.vy - _local1.pt.vy);
var temp = (Pyt(_local1.path.vx - _local1.cvpoint.vx, _local1.path.vy - _local1.cvpoint.vy) / d1);
var _local3 = temp * temp;
if (_local3 > 1) {
_local3 = 1;
}
var fac = (_local1.path.form._xscale / _local1.path.form._yscale);
_local1.form.clear();
if ((d1 * scale) > (((_local1.path.r * _local1.path.sc) / scale) * fac)) {
_local1.tangentFinder(0, Pyt(_local1.cvpoint.vx - _local1.path.vx, _local1.cvpoint.vy - _local1.path.vy) / fac, ((_local1.path.r - (_local1.lw / 2)) * _local1.path.depth) * scale);
_local1.form.beginFill(16777215);
if (_local1.lw != 0) {
_local1.form.lineStyle((_local1.lw * _local1.path.depth) * scale, 16777215);
}
var xo1 = _local1.xt1;
var xo2 = _local1.xt2;
var yo1 = (_local1.yt1 * fac);
var yo2 = (_local1.yt2 * fac);
var _local2 = ((_local1.path.form._rotation * PI) / 180) + PI;
var px1 = ((_local1.path.vx + (xo1 * sin(_local2))) - (yo1 * cos(_local2)));
var px2 = ((_local1.path.vx + (xo2 * sin(_local2))) - (yo2 * cos(_local2)));
var py1 = ((_local1.path.vy - (yo1 * sin(_local2))) - (xo1 * cos(_local2)));
var py2 = ((_local1.path.vy - (yo2 * sin(_local2))) - (xo2 * cos(_local2)));
_local1.form.moveTo(_local1.pt.vx, _local1.pt.vy);
_local1.form.curveTo((((_local1.cvpoint.vx * _local3) + (((1 - _local3) * (px1 + _local1.pt.vx)) / 2)) + px1) / 2, (((_local1.cvpoint.vy * _local3) + (((1 - _local3) * (py1 + _local1.pt.vy)) / 2)) + py1) / 2, px1, py1);
_local1.form.lineTo(px2, py2);
_local1.form.curveTo((((_local1.cvpoint.vx * _local3) + (((1 - _local3) * (px2 + _local1.pt.vx)) / 2)) + px2) / 2, (((_local1.cvpoint.vy * _local3) + (((1 - _local3) * (py2 + _local1.pt.vy)) / 2)) + py2) / 2, _local1.pt.vx, _local1.pt.vy);
_local1.form.endFill();
}
};
Rectangle.prototype = new Part();
Rectangle.prototype.draw = function (vx1, vy1, vx2, vy2) {
var _local1 = this;
_local1.form._x = vx1;
_local1.form._y = vy1;
_local1.form._xscale = vx2 - vx1;
_local1.form._yscale = vy2 - vy1;
};
Rectangle.prototype.Build = function (path) {
var _local1 = path;
_local1.clear();
_local1.beginFill(16777215);
_local1.moveTo(0, 0);
_local1.lineTo(100, 0);
_local1.lineTo(100, 100);
_local1.lineTo(0, 100);
_local1.lineTo(0, 0);
};
Limb = function (p, weight, colr, base, mid, end, lngth, cx) {
var _local1 = this;
var _local2 = mid;
_local1.register("Limb", p);
_local1.weight = weight;
_local1.setColor(colr);
if (base == 0) {
_local1.base = new Point(_local1.parent);
} else {
_local1.base = base;
}
if (_local2 == 0) {
_local1.mid = new Point(_local1.base);
} else {
_local1.mid = _local2;
_local1.mid.parent = _local1.base;
}
if (end == 0) {
_local1.end = new Point(_local1.parent);
} else {
_local1.end = end;
}
if (cx == undefined) {
if ((_local2 == undefined) or (_local2 == 0)) {
_local1.draw = _local1.drawStraight;
} else {
_local1.draw = _local1.drawJointed;
}
} else {
_local1.draw = _local1.drawCurved;
}
_local1.lngth = lngth;
_local1.cx = cx;
_local1.dir = 1;
};
Limb.ptype(Part);
Limb.prototype.invert = function () {
this.dir = -1;
};
Limb.prototype.bend = function () {
var _local1 = this;
if (_local1.end.parent == _local1.base.parent) {
var rootx = _local1.base.x;
var rooty = _local1.base.y;
var rootz = _local1.base.z;
} else {
var rootx = (_local1.base.x + _local1.base.parent.x);
var rooty = (_local1.base.y + _local1.base.parent.y);
var rootz = (_local1.base.z + _local1.base.parent.z);
}
var dx = (_local1.end.x - rootx);
var dy = (_local1.end.z - rootz);
var _local3 = atan2(dy, dx);
var _local2 = sqrt((dx * dx) + (dy * dy)) / 2;
if (_local1.cx != undefined) {
var mcx = ((((_local1.lngth * 2) - (_local2 * 2)) * _local1.cx) / (_local1.lngth * 2));
if (mcx < 0) {
var mcx = 0;
}
}
L = (_local1.lngth * (1 + mcx)) * (1 + mcx);
if (_local2 < L) {
var kiY = (sqrt((L * L) - (_local2 * _local2)) * _local1.dir);
} else {
var kiY = 0;
}
_local1.mid.x = (_local2 * cos(-_local3)) + (kiY * sin(-_local3));
_local1.mid.z = (kiY * cos(-_local3)) - (_local2 * sin(-_local3));
_local1.mid.y = ((-_local1.base.y) + _local1.end.y) / 2;
};
Limb.prototype.drawJointed = function (rote, tilt) {
var _local1 = this;
var _local2 = rote;
_local1.bend();
if (_local2 == undefined) {
_local1.mid.locateRote(_local1.face);
} else if (tilt != undefined) {
_local1.mid.locateRoteTilt(_local2, tilt);
} else {
_local1.mid.locateRote(_local2);
}
_local1.form.clear();
_local1.form.lineStyle((_local1.Weight * _local1.mid.depth) * scale, 16777215);
_local1.form.moveTo(_local1.base.vx, _local1.base.vy);
_local1.form.lineTo(_local1.mid.vx, _local1.mid.vy);
_local1.form.lineTo(_local1.end.vx, _local1.end.vy);
if (_local1.mid.form != undefined) {
_local1.mid.draw();
}
};
Limb.prototype.drawStraight = function () {
var _local1 = this;
_local1.form.clear();
_local1.form.lineStyle((_local1.Weight * _local1.base.depth) * scale, 16777215);
_local1.form.moveTo(_local1.base.vx, _local1.base.vy);
_local1.form.lineTo(_local1.end.vx, _local1.end.vy);
};
Limb.prototype.drawCurved = function (face) {
var _local1 = this;
var _local2 = face;
if (_local2 == undefined) {
_local2 = _local1.face;
}
_local1.bend();
_local1.mid.locateRote(_local2);
_local1.form.clear();
_local1.form.lineStyle((_local1.Weight * _local1.mid.depth) * scale, 16777215);
_local1.form.moveTo(_local1.base.vx, _local1.base.vy);
_local1.form.curveTo(_local1.mid.vx, _local1.mid.vy, _local1.end.vx, _local1.end.vy);
};
Limb.prototype.drawFixed = function (face) {
var _local1 = this;
_local1.form.clear();
_local1.form.lineStyle((_local1.Weight * _local1.mid.depth) * scale, 16777215);
_local1.form.moveTo(_local1.base.vx, _local1.base.vy);
_local1.form.lineTo(_local1.mid.vx, _local1.mid.vy);
_local1.form.lineTo(_local1.end.vx, _local1.end.vy);
};
Limb.prototype.zero = function () {
var _local1 = this;
_local1.end.zero();
_local1.base.zero();
_local1.mid.zero();
};
TearDrop = function (p, r, lngth, colr, shadow) {
var _local1 = this;
var _local2 = shadow;
_local1.register("TearDrop", p, _local2);
_local1.nose = new Triangle(_local1, 1, 1, colr, abs(_local2) * -1);
_local1.nose.x = lngth;
_local1.base = new Circle(_local1, r, colr, abs(_local2) * -1);
_local1.draw = _local1.Draw;
_local1.r = r;
_local1.lngth = lngth;
};
TearDrop.pType(Part);
TearDrop.prototype.Draw = function (face, tilt) {
var _local1 = this;
var _local3 = face;
_local1.base.fullMatch(_local1);
_local1.base.Draw();
_local1.nose.locateRoteTilt(_local3, tilt);
_local1.nose.positionSimple();
_local1.d = Pyt(_local1.nose.vx - _local1.base.vx, _local1.nose.vy - _local1.base.vy) / scale;
_local1.tangentFinder(_local1.d, 0, _local1.base.r * _local1.base.depth);
var xs = (_local1.d - _local1.xt1);
var ys = _local1.yt1;
_local1.nose.form._rotation = atan2(_local1.nose.vy - _local1.base.vy, _local1.nose.vx - _local1.base.vx) / (PI / 180);
_local1.nose.form._yscale = (ys * scale) * 100;
_local1.nose.form._xscale = (xs * scale) * 100;
if (_local1.shadow != undefined) {
_local1.positionShadowSrc(_local1.base);
_local1.base.shadow._xscale = (100 * _local1.r) / scale;
_local1.base.shadow._yscale = (100 * _local1.r) / scale;
var _local2 = _local1.nose.x * cos(tilt);
if (_local2 > _local1.base.r) {
_local1.tangentFinder(_local2, 0, _local1.base.r);
var xs = (_local2 - _local1.xt1);
var ys = _local1.yt1;
_local1.nose.shadow._x = (_local1.nose.x * cos(tilt)) * cos(_local3);
_local1.nose.shadow._y = (_local1.nose.x * cos(tilt)) * sin(_local3);
_local1.nose.shadow._rotation = _local3 / (PI / 180);
_local1.nose.shadow._xscale = 100 * xs;
_local1.nose.shadow._yscale = 100 * ys;
} else {
_local1.nose.shadow._yscale = 0;
_local1.nose.shadow._xscale = 0;
}
}
};
TearDrop.prototype.forceRote = function (angle) {
var _local1 = this;
var _local2 = angle;
_local1.nose.form._rotation = _local2 / (PI / 180);
_local1.nose.vx = _local1.vx + ((_local1.d * cos(_local2)) * scale);
_local1.nose.vy = _local1.vy + ((_local1.d * sin(_local2)) * scale);
_local1.nose.form._x = _local1.nose.vx;
_local1.nose.form._y = _local1.nose.vy;
};
TearDrop.prototype.setRadius = function (r) {
this.base.r = r;
};
TearDrop.prototype.setLength = function (l) {
this.nose.x = l;
};
BasicCube = function (p, unit, topcolr, btmcolr, shadow, formbase) {
this.formbase = formbase;
this.register("BasicCube", p, shadow);
this.unit = unit;
this.pts = new Array();
this.sides = new Array();
n = 0;
while (n < 8) {
var j = n;
var a = ((Math.floor(j / 4) - 0.5) * 2);
if (j >= 4) {
j = j - 4;
}
var b = ((Math.floor(j / 2) - 0.5) * 2);
if (j >= 2) {
j = j - 2;
}
var c = ((Math.floor(j) - 0.5) * 2);
this.pts[n] = new Point(this, unit * a, unit * b, unit * c);
n++;
}
var set0 = new Array(this.pts[0], this.pts[1], this.pts[3], this.pts[2]);
var set1 = new Array(this.pts[4], this.pts[6], this.pts[7], this.pts[5]);
var set2 = new Array(this.pts[6], this.pts[2], this.pts[3], this.pts[7]);
var set3 = new Array(this.pts[5], this.pts[1], this.pts[0], this.pts[4]);
var set4 = new Array(this.pts[7], this.pts[3], this.pts[1], this.pts[5]);
var set5 = new Array(this.pts[4], this.pts[0], this.pts[2], this.pts[6]);
this.colors = new Array(Palette[btmcolr], Palette[topcolr]);
if (formbase == undefined) {
this.formbase = this;
} else {
this.formbase = formbase;
}
n = 0;
while (n < 6) {
this.sides[n] = new Side(this.parent, null, eval ("set" + n), this.formbase);
n++;
}
this.cpoint = this.pts[0];
};
BasicCube.pType(Part);
BasicCube.prototype.addLid = function (insidecolor) {
var _local1 = this;
_local1.insideColor = insidecolor;
_local1.hinge = new Point(_local1);
_local1.hinge.x = -_local1.unit;
_local1.hinge.z = _local1.unit;
var _local3 = _local1.hinge;
var _local2 = _local1.unit;
var topSet = new Array(new Point(_local3, 2 * _local2, _local2), new Point(_local3, 2 * _local2, -_local2), new Point(_local3, 0, -_local2), new Point(_local3, 0, _local2));
_local1.lid = new side(_local1.parent, 0, topSet, _local1.formbase, 1);
};
BasicCube.prototype.drawLid = function (angle) {
var _local1 = this;
var _local2 = angle;
_local1.sides[4].setColor(_local1.insideColor);
_local1.hinge.locateRote(_local1.face);
_local1.hinge.roteSet(_local1.face);
_local1.hinge.tiltSet(_local2);
_local1.hinge.locateRoteTiltSrc(_local1.lid.pointset);
_local1.lid.draw();
_local1.lid.ColorBlend(0.5 - ((_local1.lid.sideFace * 0.5) * cos(_local2)), _local1.colors);
if ((sin(_local2) > 0) and (_local1.lid.sideface == -1)) {
trace("fore");
_local1.lid.fore(_local1.sides[4], 3);
} else {
_local1.lid.setDepth();
}
};
BasicCube.prototype.Draw = (BasicCube.prototype.BasicDraw = function (face, tilt) {
var _local1 = this;
var _local2 = tilt;
while (_local2 < ((-PI) / 2)) {
_local2 = _local2 + (PI / 2);
}
while (_local2 > 0) {
_local2 = _local2 - (PI / 2);
}
_local1.cpoint.roteSet(face);
_local1.cpoint.tiltSet(_local2);
_local1.cpoint.locateRoteTiltSrc(_local1.pts);
var L = _local1.sides.length;
sn = 0;
while (sn < L) {
_local1.sides[sn].draw();
if (_local1.sides[sn].sideface == 1) {
_local1.shade(_local1.sides[sn]);
}
sn++;
}
if (_local1.shadow != undefined) {
var _local3 = new Array(_local1.pts[7], _local1.pts[5], _local1.pts[0], _local1.pts[2]);
_local1.shadow.clear();
_local1.shadow.beginFill(16777215);
_local1.shadow.moveTo(_local3[0].vx, _local3[0].vys);
_local1.shadow.lineTo(_local3[1].vx, _local3[1].vys);
_local1.shadow.lineTo(_local3[2].vx, _local3[2].vys);
_local1.shadow.lineTo(_local3[3].vx, _local3[3].vys);
_local1.shadow.lineTo(_local3[0].vx, _local3[0].vys);
}
});
BasicCube.prototype.Shade = function (path) {
var _local1 = path;
var _local2 = this;
_local1.ColorBlend(0.5 + ((0.5 * (((_local1.pointSet[0].pz + _local1.pointSet[2].pz) / 2) - _local2.pz)) / _local2.unit), _local2.colors);
};
BasicCube.prototype.setDepth = function () {
var _local1 = this;
if ((_local1.formbase == _local1) and (_local1.lid == undefined)) {
_local1.setDepthNum(_local1.depth);
} else if (_local1.lid == undefined) {
sn = 0;
while (sn < 6) {
if (_local1.sides[sn].sideface == 1) {
_local1.sides[sn].setDepth();
}
sn++;
}
} else {
_local1.setDepthNum(_local1.depth);
sn = 0;
while (sn < 6) {
if (_local1.sides[sn].sideface == 1) {
_local1.sides[sn].setDepth();
}
sn++;
}
}
};
BasicCube.prototype.stackDepth = function (face) {
var _local1 = this;
var _local2 = (((((((-(_local1.x - (q.boxunit * 2))) * cos(PI / 4)) * 80) * sin(face)) - ((((_local1.y + (q.boxunit * 2)) * 80) * cos(PI / 4)) * cos(face))) + (((_local1.z - q.boxunit) * sin(PI / 4)) * 20)) + 2000) / 2;
if (_local1.formbase == _local1) {
_local1.setDepthNum(_local2);
} else {
sn = 0;
while (sn < 6) {
if (_local1.sides[sn].sideface == 1) {
_local1.sides[sn].setDepthNum(_local2 + sn);
}
sn++;
}
}
};
BasicCube.prototype.appear = function () {
var _local1 = this;
n = 0;
while (n < 6) {
_local1.sides[n].appear();
n++;
}
};
BasicCube.prototype.disappear = function () {
var _local1 = this;
n = 0;
while (n < 6) {
_local1.sides[n].disappear();
n++;
}
};
Tube = function (p, r, lngth, colr1, colr2, shadow) {
var _local1 = this;
var _local2 = shadow;
var _local3 = r;
_local1.register("Tube", p, _local2);
_local1.lngth = lngth;
_local1.r = _local3;
_local1.middle = new Square(_local1, 1, colr1, abs(_local2) * -1);
_local1.base1 = new Disc(_local1, _local3, colr1, colr2, abs(_local2) * -1);
_local1.base2 = new Disc(_local1, _local3, colr2, colr1, abs(_local2) * -1);
_local1.base1.x = _local1.lngth / 2;
_local1.base2.x = (-_local1.lngth) / 2;
};
Tube.ptype(Part);
Tube.prototype.Draw = function (face, tilt) {
var _local1 = this;
var _local2 = face;
var _local3 = tilt;
_local1.base1.locateRoteTilt(_local2, _local3);
_local1.base1.Draw(_local2, _local3);
_local1.base2.locateRoteTilt(_local2, _local3);
_local1.base2.Draw(_local2, _local3);
_local1.base1.setDepth();
_local1.base2.setDepth();
_local1.base1.sideCheck();
_local1.base2.sideCheck();
if (_local1.shadow) {
_local1.positionShadow();
_local1.base1.PositionShadowSimple();
_local1.base2.PositionShadowSimple();
}
_local1.middle.connekt(_local1.base1, _local1.base2, 1);
};
Tube.prototype.setLength = function (lngth) {
this.base1.x = lngth / 2;
this.base2.x = (-lngth) / 2;
};
Tube.prototype.setRadius = function (r) {
var _local1 = r;
var _local2 = this;
_local2.r = _local1;
_local2.base1.r = _local1;
_local2.base2.r = _local1;
};
Dome = function (p, r, colr1, colr2, shadow, formbase, offset) {
var _local1 = this;
var _local2 = r;
var _local3 = shadow;
_local1.register("Dome", p, Math.ceil(_local3), formbase);
_local1.r = _local2;
if (_local3 == 0.5) {
_local1.nose = new HalfCircle(_local1, _local2, colr1, 0);
_local1.base = new Disc(_local1, _local2, colr2, colr1, -1);
} else {
_local1.nose = new HalfCircle(_local1, _local2, colr1, abs(_local3) * -1);
_local1.base = new Disc(_local1, _local2, colr2, colr1, abs(_local3) * -1);
}
_local1.base.x = offset;
_local1.normal = _local1.base.normal;
};
Dome.ptype(Circle);
Dome.prototype.Draw = function (face, tilt) {
var _local1 = this;
var _local2 = tilt;
_local1.base.r = (_local1.nose.r = _local1.r);
_local1.base.FullMatch(_local1);
_local1.base.Draw(face, _local2);
_local1.nose.vx = _local1.vx;
_local1.nose.vy = _local1.vy;
_local1.nose.sc = _local1.sc;
_local1.nose.Draw();
_local1.nose.form._rotation = _local1.base.form._rotation;
if (_local1.shadow != undefined) {
_local1.ShadowDraw(_local1);
if (_local1.nose.shadow != undefined) {
_local1.nose.shadow._rotation = face / (PI / 180);
_local1.nose.shadow._xscale = (((100 * cos(_local2)) * cos(_local2)) * cos(_local2)) / abs(cos(_local2));
}
}
};
BasicCube = function (p, unit, topcolr, btmcolr, shadow, formbase) {
this.formbase = formbase;
this.register("BasicCube", p, shadow);
this.unit = unit;
this.pts = new Array();
this.sides = new Array();
n = 0;
while (n < 8) {
var j = n;
var a = ((Math.floor(j / 4) - 0.5) * 2);
if (j >= 4) {
j = j - 4;
}
var b = ((Math.floor(j / 2) - 0.5) * 2);
if (j >= 2) {
j = j - 2;
}
var c = ((Math.floor(j) - 0.5) * 2);
this.pts[n] = new Point(this, unit * a, unit * b, unit * c);
n++;
}
var set0 = new Array(this.pts[0], this.pts[1], this.pts[3], this.pts[2]);
var set1 = new Array(this.pts[4], this.pts[6], this.pts[7], this.pts[5]);
var set2 = new Array(this.pts[6], this.pts[2], this.pts[3], this.pts[7]);
var set3 = new Array(this.pts[5], this.pts[1], this.pts[0], this.pts[4]);
var set4 = new Array(this.pts[7], this.pts[3], this.pts[1], this.pts[5]);
var set5 = new Array(this.pts[4], this.pts[0], this.pts[2], this.pts[6]);
this.colors = new Array(Palette[btmcolr], Palette[topcolr]);
if (formbase == undefined) {
this.formbase = this;
} else {
this.formbase = formbase;
}
n = 0;
while (n < 6) {
this.sides[n] = new Side(this.parent, null, eval ("set" + n), this.formbase);
n++;
}
this.cpoint = this.pts[0];
};
BasicCube.pType(Part);
BasicCube.prototype.addLid = function (insidecolor) {
var _local1 = this;
_local1.insideColor = insidecolor;
_local1.hinge = new Point(_local1);
_local1.hinge.x = -_local1.unit;
_local1.hinge.z = _local1.unit;
var _local3 = _local1.hinge;
var _local2 = _local1.unit;
var topSet = new Array(new Point(_local3, 2 * _local2, _local2), new Point(_local3, 2 * _local2, -_local2), new Point(_local3, 0, -_local2), new Point(_local3, 0, _local2));
_local1.lid = new side(_local1.parent, 0, topSet, _local1.formbase, 1);
};
BasicCube.prototype.drawLid = function (angle) {
var _local1 = this;
var _local2 = angle;
_local1.sides[4].setColor(_local1.insideColor);
_local1.hinge.locateRote(_local1.face);
_local1.hinge.roteSet(_local1.face);
_local1.hinge.tiltSet(_local2);
_local1.hinge.locateRoteTiltSrc(_local1.lid.pointset);
_local1.lid.draw();
_local1.lid.ColorBlend(0.5 - ((_local1.lid.sideFace * 0.5) * cos(_local2)), _local1.colors);
if ((sin(_local2) > 0) and (_local1.lid.sideface == -1)) {
trace("fore");
_local1.lid.fore(_local1.sides[4], 3);
} else {
_local1.lid.setDepth();
}
};
BasicCube.prototype.Draw = (BasicCube.prototype.BasicDraw = function (face, tilt) {
var _local1 = this;
var _local2 = tilt;
while (_local2 < ((-PI) / 2)) {
_local2 = _local2 + (PI / 2);
}
while (_local2 > 0) {
_local2 = _local2 - (PI / 2);
}
_local1.cpoint.roteSet(face);
_local1.cpoint.tiltSet(_local2);
_local1.cpoint.locateRoteTiltSrc(_local1.pts);
var L = _local1.sides.length;
sn = 0;
while (sn < L) {
_local1.sides[sn].draw();
if (_local1.sides[sn].sideface == 1) {
_local1.shade(_local1.sides[sn]);
}
sn++;
}
if (_local1.shadow != undefined) {
var _local3 = new Array(_local1.pts[7], _local1.pts[5], _local1.pts[0], _local1.pts[2]);
_local1.shadow.clear();
_local1.shadow.beginFill(16777215);
_local1.shadow.moveTo(_local3[0].vx, _local3[0].vys);
_local1.shadow.lineTo(_local3[1].vx, _local3[1].vys);
_local1.shadow.lineTo(_local3[2].vx, _local3[2].vys);
_local1.shadow.lineTo(_local3[3].vx, _local3[3].vys);
_local1.shadow.lineTo(_local3[0].vx, _local3[0].vys);
}
});
BasicCube.prototype.Shade = function (path) {
var _local1 = path;
var _local2 = this;
_local1.ColorBlend(0.5 + ((0.5 * (((_local1.pointSet[0].pz + _local1.pointSet[2].pz) / 2) - _local2.pz)) / _local2.unit), _local2.colors);
};
BasicCube.prototype.setDepth = function () {
var _local1 = this;
if ((_local1.formbase == _local1) and (_local1.lid == undefined)) {
_local1.setDepthNum(_local1.depth);
} else if (_local1.lid == undefined) {
sn = 0;
while (sn < 6) {
if (_local1.sides[sn].sideface == 1) {
_local1.sides[sn].setDepth();
}
sn++;
}
} else {
_local1.setDepthNum(_local1.depth);
sn = 0;
while (sn < 6) {
if (_local1.sides[sn].sideface == 1) {
_local1.sides[sn].setDepth();
}
sn++;
}
}
};
BasicCube.prototype.stackDepth = function (face) {
var _local1 = this;
var _local2 = (((((((-(_local1.x - (q.boxunit * 2))) * cos(PI / 4)) * 80) * sin(face)) - ((((_local1.y + (q.boxunit * 2)) * 80) * cos(PI / 4)) * cos(face))) + (((_local1.z - q.boxunit) * sin(PI / 4)) * 20)) + 2000) / 2;
if (_local1.formbase == _local1) {
_local1.setDepthNum(_local2);
} else {
sn = 0;
while (sn < 6) {
if (_local1.sides[sn].sideface == 1) {
_local1.sides[sn].setDepthNum(_local2 + sn);
}
sn++;
}
}
};
BasicCube.prototype.appear = function () {
var _local1 = this;
n = 0;
while (n < 6) {
_local1.sides[n].appear();
n++;
}
};
BasicCube.prototype.disappear = function () {
var _local1 = this;
n = 0;
while (n < 6) {
_local1.sides[n].disappear();
n++;
}
};
BirdHead = function (p, joint, r, lngth, eyeSize, eyekind, eyeColr, hx, nx, lw, colr) {
this.parent = p;
this.build(p, joint, r, lngth, eyeSize, eyekind, eyeColr, hx, nx, lw, colr);
};
BirdHead.ptype(point);
BirdHead.prototype.build = function (p, joint, r, lngth, eyeSize, eyekind, eyeColr, hx, nx, lw, colr) {
var _local1 = this;
var _local2 = r;
var _local3 = p;
_local1.r = _local2;
_local1.joint = joint;
_local1.neckPt = new Point(joint);
_local1.head = new TearDrop(_local3, _local2, lngth, colr, 1);
_local1.head.attachTo(_local1.neckPt);
_local1.head.x = (_local1.hx = hx);
_local1.neckPt.x = (_local1.nx = nx);
if (eyeSize > 0) {
_local1.eyes = new eyes(_local3, _local2, eyeSize, eyekind, eyeColr);
_local1.eyes.attachTo(_local1.head);
}
_local1.neck = new Part(_local3, 0, 0);
_local1.neck.lw = lw;
_local1.neckPt.px = _local1.parent.px;
_local1.neckPt.py = _local1.parent.py;
_local1.neckPt.pz = _local1.parent.pz;
_local1.flex = 1;
_local1.headTilt = PI / 2;
_local1.neckTilt = (-PI) / 2;
};
BirdHead.prototype.attachTo = function (path) {
this.joint = path;
this.neckPt.attachTo(path);
};
BirdHead.prototype.draw = function (headRote, headTilt, neckFace, neckTilt, stagger, lag) {
var _local1 = this;
var _local3 = headTilt;
if (_local1.flex != 1) {
_local3 = (_local3 * _local1.flex) + ((PI / 2) * (1 - _local1.flex));
var neckTilt = ((neckTilt * _local1.flex) - ((PI / 2) * (1 - _local1.flex)));
}
if (stagger) {
var hpx = (_local1.neckPt.px - _local1.parent.px);
var hpy = (_local1.neckPt.py - _local1.parent.py);
var hpz = (_local1.neckPt.pz - _local1.parent.pz);
_local1.neckPt.locateRoteTilt(neckFace, neckTilt);
_local1.neckPt.px = ((_local1.parent.px + hpx) / 2) + (_local1.neckPt.px / 2);
_local1.neckPt.py = ((_local1.parent.py + hpy) / 2) + (_local1.neckPt.py / 2);
_local1.neckPt.pz = ((_local1.parent.pz + hpz) / 2) + (_local1.neckPt.pz / 2);
_local1.neckPt.projectionData();
} else {
_local1.neckPt.locateRoteTilt(neckFace, neckTilt);
}
_local1.headRote = AngleSplit(_local1.headrote, headRote, lag);
_local1.headTilt = AngleSplit(_local1.headtilt, _local3, lag);
if (_local1.headTilt > 0) {
var chinTip = ((PI / 6) * cos(_local3));
} else {
var chinTip = (PI / 6);
}
_local1.head.locateRoteTilt(_local1.headRote, _local1.headTilt + chinTip);
_local1.head.draw(_local1.headRote, _local1.headTilt);
_local1.headForceAngle = (compress((PI / 2) + anglesplit(_local1.headForceAngle, compress(atan2(cursor.vy - _local1.head.vy, cursor.vx - _local1.head.vx)), 2)) * _local1.flex) - (PI / 2);
_local1.head.forceRote(_local1.headForceAngle);
_local1.neck.form.clear();
_local1.neck.form.lineStyle((_local1.neck.lw * _local1.joint.depth) * 10, 16777215);
_local1.neck.form.moveTo(_local1.joint.vx, _local1.joint.vy);
var _local2 = 1 - (_local1.head.r / Pyt(_local1.head.vx - _local1.neckpt.vx, _local1.head.vy - _local1.neckpt.vy));
_local1.neck.form.curveTo(_local1.neckpt.vx, _local1.neckpt.vy, (_local1.head.vx * _local2) + (_local1.neckpt.vx * (1 - _local2)), (_local1.head.vy * _local2) + (_local1.neckpt.vy * (1 - _local2)));
if (_local1.eyes != undefined) {
_local1.eyes.draw(_local1.headRote);
}
};
BirdHead.prototype.setDepth = function () {
var _local1 = this;
_local1.head.setDepth();
_local1.neck.aft(_local1.head);
};
BirdHead.prototype.mouseTrack = function (target) {
var _local1 = this;
var _local2 = target;
if ((_local2.py < _local1.neckPt.py) and (_local2.state == 0)) {
_local1.pheadTilt = atan2(_local2.pz - _local1.neckPt.pz, pyt(_local2.px - _local1.neckPt.px, _local2.py - _local1.neckPt.py));
_local1.pheadRote = atan2(_local2.py - _local1.neckPt.py, _local2.px - _local1.neckPt.px);
} else if (_local2.vx > _local1.neckPt.vx) {
_local1.pheadRote = 0;
_local1.pheadTilt = atan2(-(_local2.vy - _local1.neckPt.vy), _local2.vx - _local1.neckPt.vx);
} else {
_local1.pheadRote = PI;
_local1.pheadTilt = atan2(-(_local2.vy - _local1.neckPt.vy), -(_local2.vx - _local1.neckPt.vx));
}
};
BirdHead.prototype.mouseTrack2 = function (target) {
var _local1 = this;
var _local2 = (target.vx - _local1.neckPt.vx) / (scale * _local1.neckPt.depth);
var pz = ((-(target.vy - _local1.neckPt.vy)) / (scale * _local1.neckPt.depth));
var _local3 = pyt(_local2, pz);
if (_local3 > 15) {
var py = (_local1.joint.parent.py - _local1.neckPt.py);
} else {
var py = ((_local1.joint.parent.py - _local1.neckPt.py) - (15 * cos(((_local3 / 15) * PI) / 2)));
}
_local1.pheadTilt = atan2(pz, pyt(_local2, py));
_local1.pheadRote = atan2(py, _local2);
};
BirdHead.prototype.setHeadRadius = function (r) {
this.head.setRadius(r);
this.eyes.setHeadRadius(r);
};
BirdHead.prototype.setEyeRadius = function (r) {
this.eyes.setEyeRadius(r);
};
BirdHead.prototype.setNeckScale = function (sc) {
var _local1 = this;
_local1.head.x = _local1.hx * sc;
_local1.neckPt.x = _local1.nx * sc;
};
BirdHead.prototype.setLength = function (l) {
this.head.setLength(l);
};
BirdHead.prototype.disappear = function () {
this.head.disappear();
this.neck.disappear();
};
BirdHead.prototype.appear = function () {
this.head.appear();
this.neck.appear();
};
drawEye = function (p, width, height, pupilradius, lookRadius, eyeColr) {
var _local1 = this;
var _local2 = width;
var _local3 = height;
_local1.register("drawEye", p, 0, p);
_local1.pointset = new Array(new Point(_local1, 0, _local2), new Point(_local1, 0, 0, _local3), new Point(_local1, 0, -_local2), new Point(_local1, 0, 0, -_local3));
_local1.pupil = new Disc(_local1, pupilradius, eyeColr);
_local1.lookH = (lookRadius * (_local3 / _local2)) * 3;
_local1.lookV = lookRadius;
_local1.ew = _local2;
_local1.eh = _local3;
_local1.lookR = lookRadius;
};
drawEye.pType(Side);
drawEye.prototype.draw = function (face, tilt) {
var _local1 = this;
var _local3 = face;
_local1.pointset[0].locateRoteTilt(_local3, tilt);
_local1.pointset[1].locateRoteTilt(_local3, tilt);
_local1.pointset[2].vx = (2 * _local1.vx) - _local1.pointset[0].vx;
_local1.pointset[2].vy = (2 * _local1.vy) - _local1.pointset[0].vy;
var _local2 = _local1.form;
_local2.clear();
if (_local1.sideCheck() == 1) {
_local1.pupil.form._visible = 1;
_local1.pointset[3].vx = (2 * _local1.vx) - _local1.pointset[1].vx;
_local1.pointset[3].vy = (2 * _local1.vy) - _local1.pointset[1].vy;
_local2.beginFill(13037567);
_local2.moveTo(_local1.pointset[0].vx, _local1.pointset[0].vy);
_local2.curveTo(_local1.pointset[1].vx, _local1.pointset[1].vy, _local1.pointset[2].vx, _local1.pointset[2].vy);
_local2.curveTo(_local1.pointset[3].vx, _local1.pointset[3].vy, _local1.pointset[0].vx, _local1.pointset[0].vy);
var lookAngle = atan2(-(cursor.vy - _local1.vy), (-(cursor.vx - _local1.vx)) * sin(_local3));
var lookD = pyt(cursor.vy - _local1.vy, cursor.vx - _local1.vx);
var lookRatio = (1000 / lookD);
if (lookRatio > 1) {
var lookRatio = 1;
}
_local1.pupil.y = ((_local1.pupil.y * 3) + ((lookRatio * _local1.lookH) * cos(lookangle))) / 4;
_local1.pupil.z = ((_local1.pupil.z * 3) + ((lookRatio * _local1.lookV) * sin(lookangle))) / 4;
_local1.pupil.locateRoteTilt(_local3, tilt);
_local1.pupil.draw(_local3, Tilt);
} else {
_local1.pupil.form._visible = 0;
}
};
drawEye.prototype.open = function (inc) {
var _local1 = this;
var _local2 = inc;
_local1.pointset[1].z = _local1.eh * _local2;
_local1.pointset[3].z = (-_local1.eh) * _local2;
_local1.lookV = _local1.lookR * _local2;
};
drawEye.prototype.disappear = function (inc) {
this.pupil.disappear();
this.form._visible = 0;
};
Eyes = function (p, headr, r, kind, colr) {
var _local1 = this;
_local1.register(p);
_local1.r = r;
_local1.headR = headR;
_local1.build(r, kind, colr);
_local1.setHeadRadius(headR);
};
Eyes.ptype(Point);
eyes.prototype.Build = function (r, kind, colr) {
var _local1 = this;
var _local2 = r;
if (kind == "disc") {
_local1.eyes = new Array(new Disc(_local1.parent, _local2, colr), new Disc(_local1.parent, _local2, colr));
} else if (kind == "loop") {
_local1.eyes = new Array(new Loop(_local1.parent, "eye", _local2, null, null), new Loop(_local1.parent, "eye", _local2, null, null));
}
_local1.attachTo(_local1.parent);
};
eyes.prototype.Draw = function (face) {
var _local1 = this;
var _local2 = face;
_local1.eyes[0].locateRote(_local2 + (PI / 2));
_local1.eyes[1].locateRote(_local2 + (PI / 2));
_local1.eyes[0].draw(_local2 + (PI / 2));
_local1.eyes[1].draw(_local2 - (PI / 2));
_local1.eyes[0].setDepth();
_local1.eyes[1].setDepth();
};
eyes.prototype.DrawTwist = function (face, tilt) {
var _local1 = this;
var _local2 = face;
var _local3 = tilt;
n = 0;
while (n < 2) {
_local1.eyes[n].locateRoteTilt(_local2 + (PI / 2), _local3);
_local1.eyes[n].draw(_local2 + (PI / 2), _local3);
_local1.eyes[n].setDepth();
n++;
}
};
eyes.prototype.attachTo = function (path) {
this.eyes[0].attachTo(path);
this.eyes[1].attachTo(path);
};
eyes.prototype.disappear = function () {
this.eyes[0].disappear();
this.eyes[1].disappear();
};
eyes.prototype.setEyeRadius = function (r) {
var _local1 = this;
_local1.eyes[0].r = (_local1.eyes[1].r = (_local1.r = r));
};
eyes.prototype.setHeadRadius = function (r) {
this.eyes[0].x = r;
this.eyes[1].x = -r;
};
foldingCube = function (p, unit, colrA1, colrA2, colrB1, colrB2, shadow) {
this.register("foldingCube", p, shadow);
this.unit = unit;
this.pts = new Array();
this.sides = new Array(0, 0, 0, 0);
n = 0;
while (n < 12) {
this.pts[n] = new Point(this);
n++;
}
var set0 = new Array(this.pts[0], this.pts[1], this.pts[4], this.pts[5]);
var set1 = new Array(this.pts[1], this.pts[2], this.pts[6], this.pts[7]);
var set2 = new Array(this.pts[2], this.pts[3], this.pts[9], this.pts[8]);
var set3 = new Array(this.pts[3], this.pts[0], this.pts[11], this.pts[10]);
var set4 = new Array(this.pts[3], this.pts[2], this.pts[1], this.pts[0]);
this.pts[0].xyz(unit, unit);
this.pts[1].xyz(unit, -unit);
this.pts[2].xyz(-unit, -unit);
this.pts[3].xyz(-unit, unit);
n = 0;
while (n < 4) {
this.sides[n] = new Shape(this.parent, null, null, eval ("set" + n), shadow, this.parent);
this.sides[n].epoint = new Point(this, (this.sides[n].pointset[0].x + this.sides[n].pointset[1].x) / 2, (this.sides[n].pointset[0].y + this.sides[n].pointset[1].y) / 2);
this.sides[n].face = ((-PI) / 2) * n;
ptset = eval ("set" + n);
ptset[2].xyz(unit * 2, -unit);
ptset[2].attachTo(this.sides[n].epoint);
ptset[3].xyz(unit * 2, unit);
ptset[3].attachTo(this.sides[n].epoint);
this.sides[n].iColorBlend(colr1, colr2);
n++;
}
this.incolors = new Array(palette[colrA1], palette[colrA2]);
this.outcolors = new Array(palette[colrB1], palette[colrB2]);
this.sides[4] = new Side(this.parent, null, set4, this.parent, shadow);
this.sides[4].colorBlend(0, this.incolors);
};
foldingCube.pType(Part);
foldingCube.prototype.Draw = function (face, inc) {
var _local1 = this;
var _local3 = face;
var tilt = ((PI / 2) * inc);
pn = 0;
while (pn < 4) {
_local1.pts[pn].locateRote(_local3);
pn++;
}
sn = 0;
while (sn < 4) {
_local1.sides[sn].epoint.locateRote(_local3);
_local1.sides[sn].pointset[2].locateRoteTilt(_local1.sides[sn].face + _local3, tilt);
_local1.sides[sn].pointset[3].locateRoteTilt(_local1.sides[sn].face + _local3, tilt);
_local1.sides[sn].draw();
_local1.sides[sn].setDepth(_local1.sides[sn].epoint);
var _local2 = _local1.sides[sn].pointset;
if (_local1.sides[sn].sideface == 1) {
var cfac = ((((_local2[0].pz + _local2[2].pz) / 2) - _local1.pz) / _local1.unit);
_local1.sides[sn].colorBlend(cfac, _local1.incolors);
} else {
var cfac = (((((_local2[0].pz + _local2[2].pz) / 2) - _local1.pz) / _local1.unit) * 0.5);
_local1.sides[sn].colorBlend(cfac, _local1.outcolors);
}
sn++;
}
_local1.sides[4].draw();
};
foldingCube.prototype.disappear = function () {
var _local1 = this;
sn = 0;
while (sn < 5) {
_local1.sides[sn].disappear();
sn++;
}
};
foldingCube.prototype.unBuild = function () {
var _local1 = this;
sn = 0;
while (sn < 4) {
removeMovieClip(_local1.sides[sn].form);
delete _local1.sides[n];
sn++;
}
removeMovieClip(_local1.form);
};
foldingCube.prototype.appear = function () {
var _local1 = this;
sn = 0;
while (sn < 4) {
_local1.sides[sn].appear();
sn++;
}
};
foldingCube.prototype.attachTo = function (path) {
var _local1 = path;
var _local2 = this;
n = 0;
while (n < 4) {
_local2.sides[n].epoint.attachTo(_local1);
_local2.pts[n].attachTo(_local1);
n++;
}
};
Mockleg = function (p, src, face) {
var _local1 = this;
var _local2 = src;
_local1.register("mockleg", p, 1);
_local1.leg = new Limb(_local1, _local2.weight, 0);
_local1.leg.attachTo(p);
_local1.leg.cx = (_local1.cx = _local2.cx);
if (_local2.leg != undefined) {
_local1.leg.lngth = _local2.leg.lngth;
_local1.lngth = _local2.lngth;
} else {
_local1.leg.lngth = (_local1.lngth = _local2.lngth);
}
_local1.weight = _local2.weight;
if (face == undefined) {
_local1.face = _local2.face;
} else {
_local1.face = face;
}
_local1.leg.end = new point(_local1.leg);
_local1.leg.mid = new point(_local1.leg.end);
_local1.leg.base = new Point(_local1.leg.mid);
if (_local2.mid.parent != _local2.end) {
_local1.leg.xyz(_local2.end.px - filmspace.px, _local2.end.py - filmspace.py, _local2.end.pz - filmspace.pz);
_local1.leg.end.xyz(0, 0, 0);
_local1.leg.mid.xyz(-(_local2.end.x - _local2.mid.x), -(_local2.end.y - _local2.mid.y), -(_local2.end.z - _local2.mid.z));
_local1.leg.base.xyz(-_local2.mid.x, -_local2.mid.y, -_local2.mid.z);
} else {
_local1.leg.xyzMatch(_local2.leg);
_local1.leg.end.xyzMatch(_local2.end);
_local1.leg.mid.xyzMatch(_local2.mid);
_local1.leg.base.xyzMatch(_local2.base);
}
_local1.foot = new Dome(_local1.leg.end, _local2.foot.r, 0, 1, 0, _local1);
_local1.foot.XYZ(_local2.foot.x, _local2.foot.y, _local2.foot.z);
_local1.leg.locate();
_local1.leg.end.locateRote(_local1.face);
_local1.foot.locateRoteTilt(_local1.face, PI / 2);
_local1.foot.draw(0, PI / 2);
if (_local2.swayangle == undefined) {
_local1.swayangle = atan2(_local1.leg.base.z, _local1.leg.base.x);
_local1.baseangle = atan2(_local1.leg.mid.z, _local1.leg.mid.x);
} else {
_local1.swayangle = _local2.swayangle;
_local1.baseangle = _local2.baseangle;
_local1.dswayangle = _local2.dswayangle;
_local1.dbaseangle = _local2.dbaseangle;
}
_local1.head = new Circle(_local1, 0, 0, 0);
_local1.head.attachTo(_local1.leg.base);
_local1.setDepth(_local1.foot);
_local1.iColorShade(3);
_local1.ColorShade(_local1.foot.colorGrade());
};
Mockleg.ptype(Part);
Mockleg.prototype.sway = function () {
var _local1 = this;
_local1.leg.lngth = (_local1.leg.lngth + ((_local1.lngth * 3) / 4)) / 2;
_local1.dswayangle = _local1.dswayangle + (0.05 * cos(_local1.swayangle));
_local1.dbaseAngle = _local1.dbaseAngle + (0.1 * cos(_local1.baseangle));
_local1.dswayangle = _local1.dswayangle * 0.96;
_local1.dbaseAngle = _local1.dbaseAngle * 0.96;
_local1.swayangle = _local1.swayangle + (_local1.dswayangle - (_local1.dbaseAngle / 3));
_local1.baseangle = _local1.baseangle + ((_local1.dbaseAngle * 2) / 3);
_local1.leg.mid.x = cos(_local1.baseangle - _local1.bend) * _local1.leg.lngth;
_local1.leg.mid.z = sin(_local1.baseangle - _local1.bend) * _local1.leg.lngth;
_local1.leg.mid.y = _local1.leg.mid.y / 1.2;
_local1.leg.base.x = cos(_local1.swayangle + _local1.bend) * _local1.leg.lngth;
_local1.leg.base.z = sin(_local1.swayangle + _local1.bend) * _local1.leg.lngth;
_local1.leg.base.y = _local1.leg.base.y / 1.2;
};
Mockleg.prototype.draw = function () {
var _local1 = this;
_local1.leg.mid.locateRote(_local1.face);
_local1.leg.base.locateRote(_local1.face);
_local1.head.locateRote(_local1.face);
_local1.head.draw();
var _local2 = _local1.leg.form;
_local2.clear();
_local2.lineStyle((_local1.leg.weight * scale) * _local1.leg.base.depth, 16777215);
_local2.moveTo(_local1.leg.base.vx, _local1.leg.base.vy);
_local2.curveTo(_local1.leg.mid.vx, _local1.leg.mid.vy, _local1.leg.end.vx, _local1.leg.end.vy);
};
Mockleg.prototype.crunch = function (frac) {
var _local1 = this;
var _local2 = frac;
var dx = 0;
var _local3 = q.loke.leg.unit * (1 - (now.sf / 2));
var angle = atan2(_local3, 0);
var kiX = (_local3 / 2);
var mcx = ((((_local1.leg.lngth * 2) - (kiX * 2)) * _local1.leg.cx) / (_local1.leg.lngth * 2));
L = (_local1.leg.lngth * (1 + mcx)) * (1 + mcx);
var kiY = sqrt((L * L) - (kiX * kiX));
var midx = kiY;
var midz = (-kiX);
_local1.leg.mid.x = (midx * _local2) + (_local1.leg.mid.x * (1 - _local2));
_local1.leg.mid.z = ((_local3 / 2) * _local2) + (_local1.leg.mid.z * (1 - _local2));
_local1.leg.base.x = (_local1.leg.base.x * (1 - _local2)) - (midx * _local2);
_local1.leg.base.z = (_local1.leg.base.z * (1 - _local2)) + ((_local3 / 2) * _local2);
_local1.foot.z = (q.fxo * _local2) + (was.fxo * (1 - _local2));
_local1.foot.x = (q.fzo * _local2) + (was.fzo * (1 - _local2));
_local1.leg.z = -_local1.foot.x;
_local1.leg.x = _local1.leg.x + (((q.fxo - was.fxo) * cos(_local1.face)) * (_local2 - _local1.ofrac));
_local1.leg.y = _local1.leg.y + (((q.fxo - was.fxo) * sin(_local1.face)) * (_local2 - _local1.ofrac));
_local1.leg.locate();
_local1.leg.end.locateRote(_local1.face);
_local1.ofrac = _local2;
};
Mockleg.prototype.disappear = function () {
var _local1 = this;
_local1.foot.disappear();
_local1.leg.disappear();
_local1.head.disappear();
};
antenna = function (p, lngth, wgt, radius, base) {
var _local1 = this;
_local1.lngth = lngth;
_local1.wgt = wgt;
_local1.radius = radius;
_local1.register("antenna", p);
_local1.acvpt = new Point(base);
_local1.atip = new Circle(_local1, radius, 0, 0);
_local1.atip.attachTo(_local1.acvpt);
_local1.wire = new curvedLine(_local1, base, _local1.acvpt, _local1.atip, wgt, 0, 0);
_local1.grow(1);
};
antenna.ptype(part);
antenna.prototype.grow = function (inc) {
var _local1 = this;
var _local2 = inc;
if (_local2 <= 0.5) {
_local1.growth = _local2 * 2;
_local1.atip.r = 0;
} else {
_local1.growth = 1;
_local1.atip.r = _local1.radius * ((_local2 - 0.5) * 2);
}
_local1.acvpt.z = (_local1.lngth / 2) * _local1.growth;
_local1.atip.z = (_local1.lngth / 2) * _local1.growth;
};
antenna.prototype.draw = function (face, tilt, bend) {
var _local1 = this;
_local1.acvpt.locateRoteTilt(face, tilt);
_local1.atip.locateRoteTilt(face, tilt - (bend * _local1.growth));
_local1.atip.draw();
_local1.wire.draw();
};
DiscToCross = function (p, r, ysq, rote, colr) {
var _local1 = this;
_local1.register("DiscToCross", p);
_local1.rote = rote;
_local1.r = r;
_local1.ysq = ysq;
_local1.setColor(colr);
_local1.crossPoints = new Array(new Point(_local1));
_local1.circlePoints = new Array();
_local1.crossPt = new Point(_local1);
_local1.locate();
n = 0;
while (n < 12) {
_local1.crossPoints.push(new Point(_local1));
_local1.circlePoints.push(new Point(_local1));
n++;
}
var _local2 = _local1.crossPoints;
var u = _local1.r;
_local2[0].XYZ(0.666666666666667, 2);
_local2[1].XYZ(0.666666666666667, 0.666666666666667);
_local2[2].XYZ(2, 0.666666666666667);
_local2[3].XYZ(2, -0.666666666666667);
_local2[4].XYZ(0.666666666666667, -0.666666666666667);
_local2[5].XYZ(0.666666666666667, -2);
_local2[6].XYZ(-0.666666666666667, -2);
_local2[7].XYZ(-0.666666666666667, -0.666666666666667);
_local2[8].XYZ(-2, -0.666666666666667);
_local2[9].XYZ(-2, 0.666666666666667);
_local2[10].XYZ(-0.666666666666667, 0.666666666666667);
_local2[11].XYZ(-0.666666666666667, 2);
n = 0;
while (n < 12) {
var x = ((_local2[n].x * cos(-_local1.rote)) + (_local2[n].y * sin(-_local1.rote)));
var _local3 = (_local2[n].y * cos(-_local1.rote)) - (_local2[n].x * sin(-_local1.rote));
_local2[n].xyz(x, _local3);
n++;
}
};
DiscToCross.ptype(part);
DiscToCross.prototype.draw = function (fac) {
var _local1 = this;
var _local3 = fac;
var path = _local1.form;
path.clear();
path.beginFill(16777215);
var _local2 = _local1.r;
var ox = _local1.vx;
var oy = _local1.vy;
path.moveTo(ox + _local2, oy);
var pts = _local1.crossPoints;
_local1.crossPt.xyz(pts[11].x * _local2, pts[11].y * _local2, 0);
_local1.crossPt.locate();
var x1 = _local1.crossPt.vx;
var y1 = _local1.crossPt.vy;
var angle = (((7 * PI) / 12) + _local1.rote);
var x2 = (((_local2 * cos(angle)) * scale) * _local1.depth);
var y2 = (((_local2 * sin(angle)) * scale) * _local1.depth);
path.moveTo(((x2 + ox) * _local3) + (x1 * (1 - _local3)), (((y2 * _local1.ysq) + oy) * _local3) + (y1 * (1 - _local3)));
n = 0;
while (n < 12) {
var nb = (n - 1);
if (nb < 0) {
nb = 11;
}
_local1.crossPt.xyz(pts[n].x * _local2, pts[n].y * _local2, 0);
_local1.crossPt.locate();
var x1 = _local1.crossPt.vx;
var y1 = _local1.crossPt.vy;
_local1.crossPt.xyz(((pts[n].x + pts[nb].x) * _local2) / 2, ((pts[n].y + pts[nb].y) * _local2) / 2, 0);
_local1.crossPt.locate();
var xc1 = _local1.crossPt.vx;
var yc1 = _local1.crossPt.vy;
var angle = ((((((-(n + 1)) / 12) * PI) * 2) + ((7 * PI) / 12)) + _local1.rote);
var angleC = (angle + (PI / 12));
var x2 = (((_local2 * cos(angle)) * scale) * _local1.depth);
var y2 = (((_local2 * sin(angle)) * scale) * _local1.depth);
var xc2 = ((((_local2 * cos(angleC)) * 1.04) * scale) * _local1.depth);
var yc2 = ((((_local2 * sin(angleC)) * 1.04) * scale) * _local1.depth);
path.curveTo(((xc2 + ox) * _local3) + (xc1 * (1 - _local3)), (((yc2 * _local1.ysq) + oy) * _local3) + (yc1 * (1 - _local3)), ((x2 + ox) * _local3) + (x1 * (1 - _local3)), (((y2 * _local1.ysq) + oy) * _local3) + (y1 * (1 - _local3)));
n++;
}
_local1.form._xscale = 100;
_local1.form._yscale = 100;
_local1.form._rotation = 0;
path.endFill();
};
DiscToCross.prototype.circlePlot = function (n, r) {
var _local1 = this.circlePoints[n];
var _local2 = ((n / 12) * PI) * 2;
var _local3 = _local2 - (PI / 12);
_local1.x = r * cos(_local2);
_local1.y = r * sin(_local2);
_local1.xc = (r * cos(_local3)) * 1.04;
_local1.yc = (r * sin(_local3)) * 1.04;
};
Ball = function (p, r, colr, shadow) {
var _local1 = this;
_local1.register("ball", p, shadow);
_local1.shape = new circle(_local1, r, colr, shadow);
_local1.r = r;
};
Ball.ptype(part);
Ball.prototype.draw = function () {
var _local1 = this;
_local1.shape.fullMatch(_local1);
_local1.shape.draw();
};
Ball.prototype.Fall = function () {
var _local1 = this;
_local1.x = _local1.x + _local1.hdx;
_local1.y = _local1.y + _local1.hdy;
_local1.hdx = _local1.hdx * 0.95;
_local1.hdy = _local1.hdy * 0.95;
_local1.droptime = _local1.droptime + 1;
if (_local1.droptime > _local1.endtime) {
_local1.z = _local1.r;
_local1.droptime = _local1.dropTime - _local1.endtime;
_local1.hdz = (-(_local1.hdz - (_local1.endtime * grav))) * 0.7;
_local1.hdx = _local1.hdx * 0.7;
_local1.hdy = _local1.hdy * 0.7;
_local1.endTimeSort();
}
if ((_local1.hdz < 0.1) and ((_local1.z - _local1.r) < 0.1)) {
_local1.z = _local1.r;
_local1.hdz = 0;
_local1.droptime = 0;
_local1.endTimeSort();
} else {
_local1.z = (_local1.hzi + (_local1.hdz * _local1.droptime)) - (((0.5 * grav) * _local1.droptime) * _local1.droptime);
}
};
Ball.prototype.initialize = function () {
var _local1 = this;
_local1.hdx = 0;
_local1.hdy = 0;
_local1.hdz = 0;
_local1.endTimeSort();
};
Ball.prototype.endTimeSort = function () {
var _local2 = this;
_local2.hzi = _local2.z;
var _local3 = -0.5 * grav;
var _local1 = _local2.hdz;
var c = (_local2.hzi - _local2.r);
var t1 = (((-_local1) + sqrt((_local1 * _local1) - ((4 * _local3) * c))) / (2 * _local3));
var t2 = (((-_local1) - sqrt((_local1 * _local1) - ((4 * _local3) * c))) / (2 * _local3));
if (t1 > 0) {
_local2.endtime = t1;
} else {
_local2.endtime = t2;
}
};
Ball.prototype.run = function () {
var _local1 = this;
_local1.xi = _local1.x;
_local1.yi = _local1.y;
_local1.zi = _local1.z;
_local1.Fall();
_local1.locate();
if (((_local1.x != _local1.xi) or (_local1.y != _local1.yi)) or (_local1.z != _local1.zi)) {
_local1.draw();
}
};
Being.prototype.MotionSet = function (a, vmax, tr, thresh, scl) {
var _local1 = this;
var _local2 = scl;
_local1.a = a * _local2;
_local1.vmax = vmax * _local2;
_local1.vmin = 0.001;
_local1.tr = tr;
_local1.thresh = thresh * _local2;
};
Point.prototype.MotionMatch = function (src) {
var _local1 = src;
var _local2 = this;
_local2.v = _local1.v;
_local2.turn = _local1.turn;
_local2.face = _local1.face;
};
being.prototype.tipV = function (tip, fac, drag) {
var _local1 = tip;
if ((cos(_local1) == 0) or (sin(_local1) == 0)) {
q.tipV = 0;
} else {
q.tipV = q.tipV + ((((((-fac) * sin(_local1)) / abs(sin(_local1))) * cos(_local1)) / abs(cos(_local1))) * abs(cos(_local1) * sin(_local1)));
}
q.tipV = q.tipV * drag;
};
Point.prototype.Move = function (target) {
var _local1 = this;
_local1.moveData(target);
_local1.moveUpdate(_local1.turn, _local1.v);
};
Point.prototype.vMove = function (target) {
var _local1 = this;
_local1.VmoveData(target);
_local1.moveUpdate(_local1.turn, _local1.v);
};
Point.prototype.MoveData = function (target) {
var _local1 = this;
if ((routePlace == route.length) or (_local1.slowswitch == 1)) {
_local1.vMoveData(target);
} else {
_local1.sMoveData(target);
}
};
Point.prototype.SMoveData = function (target) {
var _local1 = this;
var _local3 = target.py - _local1.py;
var tx = (target.px - _local1.px);
var aim = atan2(_local3, tx);
_local1.diff = compress(aim - _local1.face);
var _local2 = sqrt(abs(_local1.diff));
if (_local2 > 1) {
_local2 = 1;
}
if (abs(_local1.diff) > 0.05) {
if (_local1.diff > 0) {
_local1.turn = _local1.turn + (_local1.tR * _local2);
} else if (_local1.diff < 0) {
_local1.turn = _local1.turn - (_local1.tR * _local2);
}
}
_local1.turn = _local1.turn * 0.9;
var d = sqrt((tx * tx) + (_local3 * _local3));
if (_local1.v > (_local1.vmax + _local1.a)) {
_local1.v = _local1.v - _local1.a;
} else if (_local1.v < (_local1.vmax - _local1.a)) {
_local1.v = _local1.v + _local1.a;
} else {
_local1.v = _local1.vmax;
}
_local1.v = _local1.v * cos(_local1.turn);
};
Point.prototype.VMoveData = function (target) {
var _local1 = this;
var ty = (target.py - _local1.py);
var tx = (target.px - _local1.px);
var aim = atan2(ty, tx);
_local1.diff = compress(aim - _local1.face);
var _local3 = sqrt((tx * tx) + (ty * ty));
var _local2 = sqrt(abs(_local1.diff)) * (_local1.v / _local1.vmax);
if (_local2 > 1) {
_local2 = 1;
}
if (abs(_local1.diff) > 0.05) {
if (_local1.diff > 0) {
_local1.turn = _local1.turn + (_local1.tR * _local2);
} else if (_local1.diff < 0) {
_local1.turn = _local1.turn - (_local1.tR * _local2);
}
}
_local1.turn = _local1.turn * 0.9;
_local1.tmin = q.r;
if (_local3 > _local1.tmin) {
var steps = (_local1.v / _local1.a);
var threshold = ((steps * _local1.v) / 2);
} else {
threshold = _local1.tmin;
}
if ((_local3 < threshold) or (_local1.slowSwitch == 1)) {
_local1.slowSwitch = 0;
if (abs(_local1.v) < abs(_local1.a + _local1.vmin)) {
_local1.v = _local1.vmin;
} else if (_local1.v > (_local1.a + _local1.vmin)) {
_local1.v = _local1.v - _local1.a;
} else if (_local1.v < (_local1.a + _local1.vmin)) {
_local1.v = _local1.vmin;
}
} else if (_local3 > threshold) {
_local1.v = _local1.v + _local1.a;
if (_local1.v > _local1.vmax) {
if ((_local1.v - _local1.vmax) > (2 * _local1.a)) {
_local1.v = _local1.v - (2 * _local1.a);
} else {
_local1.v = _local1.vmax;
}
}
}
};
Point.prototype.MoveUpdate = function (turn, v) {
var _local1 = this;
_local1.face = compress(_local1.face + turn);
_local1.movx = cos(_local1.face) * v;
_local1.movy = sin(_local1.face) * v;
_local1.x = _local1.x + _local1.movx;
_local1.y = _local1.y + _local1.movy;
};
function Loke(parent, kind, legSrc, dataSrc, fulcrum) {
var _local1 = this;
var _local2 = dataSrc;
var _local3 = legSrc;
if (_local2 == undefined) {
_local2 = q;
}
_local1.parent = parent;
_local1.x = _local1.parent.x;
_local1.y = _local1.parent.y;
_local1.cz = _local1.parent.center.z;
_local1.state = 1;
_local1.osc = 0;
switch (kind) {
case "hop" :
_local1.model = _local1.HopModel;
_local1.leg = new DataLeg(_local3, 0, _local2.unit);
_local1.legs = new Array(_local1.leg);
break;
case "run" :
_local1.model = _local1.RunModel;
_local1.legs = new Array(new DataLeg(_local3[0], -1, _local2.unit), new DataLeg(_local3[1], 1, _local2.unit));
_local1.aLeg = _local1.legs[0];
_local1.iLeg = _local1.legs[1];
break;
case "walk" :
_local1.model = _local1.WalkModel;
_local1.legs = new Array(new DataLeg(_local3[0], -1, _local2.unit), new DataLeg(_local3[1], 1, _local2.unit));
_local1.aLeg = _local1.legs[0];
_local1.iLeg = _local1.legs[1];
break;
case "roll" :
_local1.model = _local1.RollModel;
_local1.legs = new Array(new DataLeg(_local3[0], -1, _local2.unit), new DataLeg(_local3[1], 1, _local2.unit));
_local1.aLeg = _local1.legs[0];
_local1.iLeg = _local1.legs[1];
break;
case "tri" :
_local1.model = _local1.TriWalkModel;
_local1.legs = new Array(new DataLeg(_local3[0], 0, _local2.unit), new DataLeg(_local3[1], 0, _local2.unit), new DataLeg(_local3[2], 0, _local2.unit));
_local1.aLeg = _local1.legs[0];
_local1.iLegA = _local1.legs[1];
_local1.iLegB = _local1.legs[2];
}
if (fulcrum == undefined) {
_local1.fulcrum = _local3[0].base.parent;
} else {
_local1.fulcrum = fulcrum;
}
_local1.lokeSet(_local2.czo, _local2.fxo, _local2.zo, _local2.unit, _local2.yw1, _local2.yw2, _local2.tBmx, _local2.sF, _local2.cF, _local2.ob);
}
Loke.prototype.LokeSet = function (czo, fxo, zo, unit, yw1, yw2, tBmx, sF, cF, ob) {
var _local1 = this;
_local1.czo = czo;
_local1.fxo = fxo;
_local1.zo = zo;
_local1.unit = unit;
_local1.yw1 = yw1;
_local1.yw2 = yw2;
_local1.tBmx = tBmx;
_local1.sF = sF;
_local1.cF = cF;
_local1.ob = ob;
};
Loke.prototype.VarSuck = function (src) {
var _local1 = this;
var _local2 = src;
_local1.czo = _local2.czo;
_local1.fxo = _local2.fxo;
_local1.zo = _local2.zo;
_local1.unit = _local2.unit;
_local1.yw1 = _local2.yw1;
_local1.yw2 = _local2.yw2;
_local1.tBmx = _local2.tBmx;
_local1.sF = _local2.sF;
_local1.cF = _local2.cF;
_local1.ob = _local2.ob;
var _local3 = _local1.legs.length;
n = 0;
while (n < _local3) {
_local1.legs[n].unit = _local1.unit;
n++;
}
};
DataLeg = function (src, side, unit) {
var _local1 = this;
var _local2 = src;
_local1.src = _local2;
_local1.sz = 1;
_local1.unit = unit;
_local1.__proto__ = _local1.src;
if (side != 0) {
_local1.side = side;
}
_local1.ankle = new Point();
_local1.ankle.x = _local2.end.x;
_local1.ankle.y = _local2.end.y;
_local1.ankle.z = _local2.end.z;
};
Dataleg.prototype = new Point();
Loke.prototype.process = (Loke.prototype.regProcess = function (v, vm) {
var _local1 = this;
_local1.prepare(v);
_local1.model(_local1.v, vm);
_local1.transmit();
});
Loke.prototype.prepare = function (v) {
var _local1 = this;
var _local3 = v;
if (((_local1.fulcrum.x == 0) or (_local1.fulcrum == undefined)) or (_local1.fulcrum.x == undefined)) {
_local1.turn = _local1.parent.turn;
_local1.face = _local1.parent.face;
_local1.v = _local3;
} else {
var xo = _local1.fulcrum.x;
var _local2 = sin(_local1.parent.turn) * xo;
_local1.face = atan2(_local2, _local3) + _local1.parent.face;
_local1.turn = _local1.face - _local1.iface;
if (_local1.turn < ((-PI) * 2)) {
_local1.turn = _local1.turn + (PI * 2);
} else if (_local1.turn > (PI * 2)) {
_local1.turn = _local1.turn - (PI * 2);
}
_local1.iface = _local1.face;
_local1.v = sqrt((_local3 * _local3) + (_local2 * _local2));
}
};
Loke.prototype.transmit = function () {
var _local1 = this;
q.tip = _local1.tip;
_local1.fulcrum.z = _local1.cz + _local1.czo;
_local1.feetMatch(_local1.legs.length);
};
Loke.prototype.attachTo = function (path) {
var _local1 = this;
var _local2 = path;
_local1.fulcrum = _local2;
var _local3 = _local1.legs.length;
n = 0;
while (n < _local3) {
_local1.legs[n].src.base.attachTo(_local2);
_local1.legs[n].src.mid.attachTo(_local1.legs[n].src.base);
_local1.legs[n].src.end.attachTo(_local2);
n++;
}
};
Loke.prototype.LokeSync = function (src) {
var _local1 = src;
var _local2 = this;
_local2.osc = _local1.osc;
_local2.oscAdd = _local1.oscAdd;
_local2.state = _local1.state;
_local2.vzi = _local1.vzi;
_local2.vz = _local1.vz;
_local2.cz = _local1.cz;
_local2.airTime = _local1.airTime;
_local2.airCycle = _local1.airCycle;
_local2.vh = _local1.vh;
_local2.tip = _local1.tip;
};
Loke.prototype.feetMatch = function (num) {
var _local2 = this;
var _local3 = num;
n = 0;
while (n < _local3) {
var _local1 = _local2.legs[n];
_local1.src.footTip = _local1.footTip;
_local1.src.footFace = _local1.footFace;
_local1.end.XYZmatch(_local1.ankle);
_local1.end.z = _local1.end.z - _local2.czo;
n++;
}
};
Loke.prototype.wasMatch = (Loke.prototype.Match = function (src) {
var _local1 = this;
var _local2 = src;
_local1.lokeSync(_local2);
if (_local2.aleg == _local2.legs[0]) {
_local1.aleg = _local1.legs[0];
_local1.ileg = _local1.legs[1];
} else {
_local1.aleg = _local1.legs[1];
_local1.ileg = _local1.legs[0];
}
_local1.aleg.ankle.xyzMatch(_local2.aleg.ankle);
_local1.ileg.ankle.xyzMatch(_local2.ileg.ankle);
_local1.aleg.ankle.ixyzMatch(_local2.aleg.ankle);
_local1.ileg.ankle.ixyzMatch(_local2.ileg.ankle);
_local1.aleg.airfrac = _local2.aleg.airfrac;
_local1.ileg.airfrac = _local2.ileg.airfrac;
});
Loke.prototype.legSwitch = function () {
var _local1 = this;
if (_local1.aLeg == _local1.legs[0]) {
_local1.aLeg = _local1.legs[1];
_local1.iLeg = _local1.legs[0];
} else {
_local1.aLeg = _local1.legs[0];
_local1.iLeg = _local1.legs[1];
}
};
Loke.prototype.HopModel = function (v, vm) {
var _local1 = this;
var _local3 = v;
_local1.vh = _local3;
_local1.aLeg = _local1.leg;
_local1.tB = (_local1.tBmx * _local3) / vm;
switch (_local1.state) {
case 1 :
var _local2 = ((_local3 / ((sin(_local1.tB) * _local1.aLeg.unit) * _local1.sF)) * _local3) / vm;
if (_local2 == undefined) {
_local2 = 0;
} else if (_local2 > 1) {
_local2 = 1;
}
_local1.oscAdd = Math.asin(_local2);
_local1.osc = _local1.osc + _local1.oscAdd;
if (_local1.osc > (PI / 2)) {
_local1.airTime = (_local1.osc - (PI / 2)) / _local1.oscAdd;
_local1.osc = PI / 2;
_local1.Spring(_local1.aLeg, 1 - _local1.airTime);
_local1.Launch(_local1.aLeg);
_local1.airCycle = (2 * _local1.vzi) / grav;
_local1.Airborne(_local1.airTime);
_local1.airLegFlex(_local1.leg, _local1.airTime / _local1.airCycle);
_local1.state = 2;
return;
}
_local1.Spring(_local1.aLeg, 1);
return;
case 2 :
if ((_local1.airCycle - _local1.airTime) >= 1) {
_local1.Airborne(1);
_local1.airTime = _local1.airTime + 1;
_local1.airLegFlex(_local1.leg, _local1.airTime / _local1.airCycle);
} else {
_local1.Airborne(_local1.airCycle - _local1.airTime);
_local1.osc = ((-PI) / 2) + ((1 - (_local1.airCycle - _local1.airTime)) * _local1.oscAdd);
_local1.Spring(_local1.aLeg, 1 - (_local1.airCycle - _local1.airTime));
_local1.state = 1;
}
}
};
Loke.prototype.RunModel = function (v, vm) {
var _local1 = this;
var _local3 = v;
_local1.vh = _local3;
_local1.tB = (_local1.tBmx * (_local3 / vm)) + 0.0001;
if ((_local1.vzi == undefined) or (_local1.vzi == 0)) {
_local1.thrust = (_local1.unit * sin(_local1.oscAdd)) * _local1.sF;
_local1.vzi = _local1.thrust * cos(_local1.tB);
}
_local1.oscAdd = (Math.asin(_local3 / ((sin(_local1.tB) * _local1.unit) * _local1.sF)) * _local3) / vm;
_local1.airGapCycle = (2 * _local1.vzi) / grav;
_local1.groundCycle = PI / _local1.oscAdd;
_local1.airCycle = _local1.groundCycle + (_local1.airGapCycle * 2);
switch (_local1.state) {
case 1 :
_local1.osc = _local1.osc + _local1.oscAdd;
if (_local1.osc > (PI / 2)) {
var _local2 = (_local1.osc - (PI / 2)) / _local1.oscAdd;
_local1.osc = PI / 2;
_local1.Spring(_local1.aLeg, 1 - _local2);
_local1.Launch(_local1.aLeg);
_local1.airGapCycle = (2 * _local1.vzi) / grav;
_local1.airCycle = _local1.groundCycle + (_local1.airGapCycle * 2);
_local1.Airborne(_local2);
_local1.iLeg.airFrac = ((_local2 + _local1.airGapCycle) + _local1.groundCycle) / _local1.airCycle;
_local1.aLeg.airFrac = _local2 / _local1.airCycle;
_local1.airLegFlex(_local1.aLeg, _local1.aLeg.airFrac);
_local1.airLegFlex(_local1.iLeg, _local1.iLeg.airFrac);
_local1.state = 2;
break;
}
_local1.aLeg.airFrac = ((_local1.osc - (PI / 2)) / _local1.oscAdd) / _local1.airCycle;
_local1.iLeg.airFrac = _local1.aLeg.airFrac + ((_local1.airGapCycle + _local1.groundCycle) / _local1.airCycle);
_local1.Spring(_local1.aLeg, 1);
_local1.airLegFlex(_local1.iLeg, _local1.iLeg.airFrac);
break;
case 2 :
if (_local1.iLeg.airFrac <= (1 - (1 / _local1.airCycle))) {
_local1.Airborne(1);
_local1.aLeg.airFrac = _local1.aLeg.airFrac + (1 / _local1.airCycle);
_local1.iLeg.airFrac = _local1.iLeg.airFrac + (1 / _local1.airCycle);
_local1.airLegFlex(_local1.aLeg, _local1.aLeg.airFrac);
_local1.airLegFlex(_local1.iLeg, _local1.iLeg.airFrac);
} else {
_local1.Airborne((1 - _local1.iLeg.airFrac) * _local1.airCycle);
_local1.airLegFlex(_local1.iLeg, 1);
_local1.aLeg.airFrac = _local1.aLeg.airFrac + (1 / _local1.airCycle);
_local1.iLeg.airFrac = _local1.iLeg.airFrac + (1 / _local1.airCycle);
_local1.osc = ((-PI) / 2) + (((_local1.iLeg.airFrac - 1) * _local1.oscAdd) * _local1.airCycle);
_local1.legSwitch();
_local1.Spring(_local1.aLeg, (_local1.aLeg.airFrac - 1) * _local1.airCycle);
_local1.airLegFlex(_local1.iLeg, _local1.iLeg.airFrac);
_local1.state = 1;
}
}
var TEMPvzi = (((_local1.unit * sin(_local1.oscAdd)) * _local1.sF) * cos(_local1.tB));
var TEMPairGapCycle = ((2 * TEMPvzi) / grav);
var wholeCycle = (2 * (TEMPairGapCycle + _local1.groundCycle));
if (_local1.state == 1) {
var halfcycle = ((_local1.osc + (PI / 2)) / _local1.oscAdd);
} else {
var halfcycle = ((PI / _local1.oscAdd) + (_local1.aleg.airfrac * _local1.airCycle));
}
if (_local1.aleg == _local1.legs[0]) {
var time = halfcycle;
} else {
var time = ((wholecycle / 2) + halfcycle);
}
_local1.cycle = ((2 * PI) * time) / wholeCycle;
};
Loke.prototype.WalkModel = function (v, vm) {
var _local1 = this;
_local1.vh = v;
_local1.tB = _local1.tBmx;
_local1.oscAdd = (PI * v) / (sin(_local1.TB) * _local1.unit);
_local1.osc = _local1.osc + _local1.oscAdd;
if (_local1.osc > (PI / 2)) {
_local1.WalkSpring(_local1.aLeg, ((PI / 2) - (_local1.osc - _local1.oscAdd)) / _local1.oscAdd);
_local1.airLegFlexWalk(_local1.iLeg, 1);
_local1.legSwitch();
_local1.osc = _local1.osc - PI;
_local1.WalkSpring(_local1.aLeg, (_local1.osc + (PI / 2)) / _local1.oscAdd);
} else {
_local1.WalkSpring(_local1.aLeg, 1);
}
_local1.iLeg.airFrac = (_local1.osc + (PI / 2)) / PI;
_local1.airLegFlexWalk(_local1.iLeg, _local1.iLeg.airFrac);
};
Loke.prototype.TriWalkModel = function (v) {
var _local1 = this;
_local1.tB = _local1.tBmx;
var _local2 = (_local1.unit * cos(PI / 3)) * 2;
_local1.vh = v + abs(_local1.aleg.ankle.x * sin(_local1.turn));
_local1.oscAdd = ((PI / 2) * _local1.vh) / _local2;
_local1.osc = _local1.osc + _local1.oscAdd;
_local1.cz = (_local1.unit - 1) + (1 * (((-sin(_local1.osc * 2)) + 1) / 2));
if (_local1.osc > (PI / 2)) {
_local1.WalkSpring(_local1.aLeg, (_local1.osc - (PI / 2)) / _local1.oscAdd);
_local1.JumpAirLegFlex(_local1.iLegA, 1);
_local1.TriLegSwitch();
_local1.osc = _local1.osc - PI;
_local1.TriWalkSpring(_local1.aLeg, (_local1.osc + (PI / 2)) / _local1.oscAdd);
} else {
_local1.TriWalkSpring(_local1.aLeg, 1);
}
_local1.iLegB.airFrac = (0.5 * (_local1.osc + (PI / 2))) / PI;
_local1.iLegA.airFrac = _local1.iLegB.airFrac + 0.5;
_local1.JumpAirLegFlex(_local1.iLegA, _local1.iLegA.airFrac);
_local1.JumpAirLegFlex(_local1.iLegB, _local1.iLegB.airFrac);
if (_local1.aleg == _local1.legs[0]) {
_local1.cycle = ((_local1.osc * 2) / 3) + (PI / 3);
} else if (_local1.aleg == _local1.legs[1]) {
_local1.cycle = ((_local1.osc * 2) / 3) + PI;
} else if (_local1.aleg == _local1.legs[2]) {
_local1.cycle = ((_local1.osc * 2) / 3) + ((5 * PI) / 3);
}
};
Loke.prototype.TriLegSwitch = function () {
var _local1 = this;
var _local2 = _local1.aLeg;
_local1.aLeg = _local1.iLegA;
_local1.iLegA = _local1.iLegB;
_local1.iLegB = _local2;
};
Loke.prototype.Spring = function (path, inc) {
var _local1 = this;
var _local2 = path.ankle;
var _local3 = _local1.turn * inc;
_local1.tip = _local1.tB * sin(_local1.osc);
var extension = (path.unit - ((path.unit * cos(_local1.osc)) * _local1.sF));
_local1.cz = (cos(_local1.tip) * extension) - _local1.zo;
_local1.thrust = (path.unit * sin(_local1.oscAdd)) * _local1.sF;
_local2.z = ((-cos(_local1.tip)) * extension) - _local1.zo;
_local2.x = _local2.x - ((_local1.vh * cos(_local3)) * inc);
_local2.y = _local2.y - ((_local1.vh * sin(_local3)) * inc);
var tpx = (_local2.x - _local1.fxo);
var tpy = _local2.y;
_local2.x = ((tpx * cos(_local3)) + (tpy * sin(_local3))) + _local1.fxo;
_local2.y = (tpy * cos(_local3)) - (tpx * sin(_local3));
path.foottip = PI / 2;
};
Loke.prototype.TriWalkSpring = function (path, inc) {
var _local1 = this;
var _local2 = path.ankle;
_local2.ix = _local2.x;
_local2.iy = _local2.y;
var _local3 = _local1.turn * inc;
_local1.tip = _local1.tb * sin(_local1.osc);
var extension = (path.unit - (((path.unit * (cos(_local1.osc * 2) + 1)) / 2) * _local1.sF));
var spring = (extension * cos(_local1.tip));
_local1.cz = spring - _local1.zo;
_local2.z = (-spring) - _local1.zo;
_local2.x = _local2.x - ((_local1.v * cos(_local3)) * inc);
_local2.y = _local2.y - ((_local1.v * sin(_local3)) * inc);
var tpx = (_local2.x - _local1.fxo);
var tpy = _local2.y;
_local2.x = ((tpx * cos(_local3)) + (tpy * sin(_local3))) + _local1.fxo;
_local2.y = (tpy * cos(_local3)) - (tpx * sin(_local3));
};
Loke.prototype.WalkSpring = function (path, inc) {
var _local1 = this;
var _local2 = path.ankle;
_local2.ix = _local2.x;
_local2.iy = _local2.y;
var _local3 = _local1.turn * inc;
_local1.tip = _local1.tB * sin(_local1.osc);
var extension = (path.unit - (((path.unit * (cos(_local1.osc * 2) + 1)) / 2) * _local1.sF));
var spring = (cos(_local1.tip) * extension);
_local2.z = (-spring) - _local1.zo;
_local1.cz = spring - _local1.zo;
_local2.x = _local2.x - ((_local1.v * cos(_local3)) * inc);
_local2.y = _local2.y - ((_local1.v * sin(_local3)) * inc);
var tpx = (_local2.x - _local1.fxo);
var tpy = _local2.y;
_local2.x = ((tpx * cos(_local3)) + (tpy * sin(_local3))) + _local1.fxo;
_local2.y = (tpy * cos(_local3)) - (tpx * sin(_local3));
};
Loke.prototype.WalkSpring2 = function (path, inc) {
var _local1 = this;
var _local2 = path.ankle;
_local2.ix = _local2.x;
_local2.iy = _local2.y;
var _local3 = _local1.turn * inc;
_local1.tip = _local1.tb * sin(_local1.osc);
var extension = (path.unit - (((path.unit * (cos(_local1.osc * 2) + 1)) / 2) * _local1.ob));
var spring = (cos(_local1.tip) * extension);
_local1.cz = spring - _local1.zo;
_local2.z = (-spring) - _local1.zo;
_local2.x = _local2.x - ((_local1.v * cos(_local3)) * inc);
_local2.y = _local2.y - ((_local1.v * sin(_local3)) * inc);
var tpx = (_local2.x - _local1.fxo);
var tpy = _local2.y;
_local2.x = ((tpx * cos(_local3)) + (tpy * sin(_local3))) + _local1.fxo;
_local2.y = (tpy * cos(_local3)) - (tpx * sin(_local3));
};
Loke.prototype.AirLegFlex = function (path, frac) {
var _local3 = path;
var _local1 = _local3.ankle;
var xi = _local1.x;
var zi = _local1.z;
var _local2 = 2 * (frac - 0.5);
if (_local2 < 0) {
_local1.x = (-_local1.ix) * _local2;
_local1.y = ((-_local1.iy) * _local2) + ((this.yw2 * _local3.side) * (1 + _local2));
} else {
var stride = (_local3.unit * sin(this.tB));
_local1.x = (stride + this.fxo) * _local2;
_local1.y = ((this.yw2 * _local3.side) * (1 - _local2)) + ((this.yw1 * _local3.side) * _local2);
}
var contract = (1 - (((cos(_local2 * PI) + 1) / 2) * this.cF));
_local3.foottip = (((atan2(_local3.src.mid.z - _local1.z, _local3.src.mid.x - _local1.x) - (PI / 2)) * scurve(1 - abs(_local2))) - ((PI / 4) * scurve(1 - (_local2 * _local2)))) + (PI / 2);
_local3.footface = this.parent.face;
_local1.z = (((-_local3.unit) * cos(this.tip)) * contract) - this.zo;
_local1.dx = _local1.x - xi;
_local1.dz = _local1.z - zi;
};
Loke.prototype.AirLegFlexWalk = function (path, frac) {
var _local2 = this;
var _local3 = path.ankle;
var _local1 = 2 * (frac - 0.5);
if (_local1 < 0) {
_local3.x = (-_local3.ix) * sin((_local1 * PI) / 2);
_local3.y = (_local3.iy * scurve(-_local1)) + ((_local2.yw2 * path.side) * scurve(1 + _local1));
} else {
var stride = ((_local2.unit * sin(_local2.tb)) / 2);
_local3.x = ((stride * sin(_local2.tB)) + _local2.fxo) * sin((_local1 * PI) / 2);
_local3.y = ((_local2.yw2 * path.side) * scurve(1 - _local1)) + ((_local2.yw1 * path.side) * scurve(_local1));
}
var contract = (1 - (cos(PI * (frac - 0.5)) * _local2.cF));
path.foottip = (((atan2(path.src.mid.z - _local3.z, path.src.mid.x - _local3.x) - (PI / 2)) * (1 - abs(_local1))) - ((PI / 4) * (1 - (_local1 * _local1)))) + (PI / 2);
path.footface = _local2.parent.face;
_local3.z = (((-path.unit) * cos(_local2.tip)) * contract) - _local2.zo;
};
Loke.prototype.JumpAirLegFlex = function (path, frac) {
var _local1 = path.ankle;
var xi = _local1.x;
var zi = _local1.z;
var _local2 = 2 * (frac - 0.5);
var _local3 = (PI / 2) - (_local2 * (PI - this.tb));
var extension = (path.unit - ((path.unit * cos((_local2 * PI) / 2)) * this.cf));
var tz = (extension * sin(_local3));
var tx = (extension * cos(_local3));
if (_local2 < 0) {
_local1.x = (tx * (1 - (_local2 * _local2))) + ((_local1.ix * _local2) * _local2);
_local1.y = (-_local1.iy) * _local2;
_local1.z = tz + q.czo;
path.footTip = ((_local3 + (PI / 2)) * (1 + _local2)) - (((5 * PI) / 2) * _local2);
} else {
_local1.y = 0;
_local1.x = tx;
_local1.z = tz + q.czo;
path.footTip = ((_local3 + (PI / 2)) * (1 - _local2)) + ((PI / 2) * _local2);
}
_local1.dx = _local1.x - xi;
_local1.dz = _local1.z - zi;
};
Loke.prototype.Airborne = function (inc) {
var _local1 = this;
var _local2 = inc;
_local1.vz = _local1.vz + (((-grav) * _local2) / 2);
_local1.tip = _local1.tB * (_local1.vz / _local1.vzi);
_local1.x = _local1.x + ((_local1.vh * cos(_local1.face)) * _local2);
_local1.y = _local1.y + ((_local1.vh * sin(_local1.face)) * _local2);
_local1.cz = _local1.cz + (_local1.vz * _local2);
_local1.vz = _local1.vz + (((-grav) * _local2) / 2);
};
Loke.prototype.Launch = function (path) {
var _local2 = this;
var _local1 = path.ankle;
_local2.vz = (_local2.vzi = _local2.thrust * cos(_local2.tB));
_local1.ix = _local1.x;
_local1.iy = _local1.y;
_local1.iz = _local1.z;
};
being.prototype.legSet = function (path) {
var _local1 = path;
_local1.cx = q.cx;
_local1.lngth = q.LL;
_local1.weight = q.LW;
_local1.appear();
};
Being.prototype.drawDomeLeg = function (path, alwaysDraw) {
var _local1 = path;
var _local2 = this;
_local1.base.locateRote(_local2.face);
_local1.end.locateRote(_local2.face);
_local1.drawCurved(_local2.face);
_local1.foot.locateRoteTilt(_local2.face, ((_local1.footTip - (PI / 2)) * q.tipFactor) + (PI / 2));
if ((Math.abs(_local1.foot.oldz - _local1.foot.pz) > 1E-5) or (alwaysDraw == 1)) {
_local1.foot.draw(_local2.face, ((_local1.footTip - (PI / 2)) * q.tipFactor) + (PI / 2));
}
_local1.setDepth(_local1.end);
_local1.foot.fore(_local1.end);
_local1.foot.oldz = _local1.foot.pz;
};
being.prototype.switchCondition = function (letter) {
return(1);
};
being.prototype.segueCondition = function () {
return(1);
};
being.prototype.changeCondition = function () {
return(1);
};
Being.prototype.segueCondition = function () {
return(1);
};
Being.prototype.standardRoutes = function () {
q.routes = new Array();
var _local1 = q.links.length;
n = 0;
while (n < _local1) {
q.routes[n] = new Array();
q.routes[n][0] = q.links[n].letter;
n++;
}
};
function segStack(arr, fac) {
var L = arr.length;
n = 0;
while (n < L) {
var name = arr[n];
var old = eval ("below." + name);
var nu = eval ("now." + name);
Set("q." + name, (old * (1 - fac)) + (nu * fac));
n++;
}
}
function Link(form, letter, inSeg, outSeg) {
var _local2 = this;
var _local3 = letter;
n = 0;
while (n < 26) {
if (letterList[n] == _local3) {
var _local1 = n;
}
n++;
}
_local2.id = _local1;
_local2.form = form;
if (inSeg == undefined) {
_local2.inSegLength = 0;
} else {
_local2.inSegLength = inSeg;
}
if (outSeg == undefined) {
_local2.outSegLength = _local2.inSegLength;
} else {
_local2.outSegLength = outSeg;
}
_local2.letter = _local3;
}
being.prototype.tune = function (path, src, factor) {
var _local1 = path;
var _local2 = factor;
var _local3 = src;
_local1.x = (_local1.x * _local2) + (_local3[0] * (1 - _local2));
_local1.y = (_local1.y * _local2) + (_local3[1] * (1 - _local2));
_local1.z = (_local1.z * _local2) + (_local3[2] * (1 - _local2));
};
being.prototype.XYZtune = function (path, src, factor) {
var _local1 = path;
var _local2 = factor;
var _local3 = src;
_local1.x = (_local1.x * _local2) + (_local3.x * (1 - _local2));
_local1.y = (_local1.y * _local2) + (_local3.y * (1 - _local2));
_local1.z = (_local1.z * _local2) + (_local3.z * (1 - _local2));
};
_global.Egg = function () {
};
Egg.ptype(Being);
EggProperties = function () {
var _local1 = this;
_local1.scl = 0.15;
_local1.id = letterCrunch("e");
_local1.r = 24 * _local1.scl;
_local1.eyeR = 7 * _local1.scl;
_local1.YS = 1.3;
_local1.wheelr = 50 * _local1.scl;
};
Egg.prototype.arrange = function () {
q.head = new Oval(this, q.r, q.YS, 0, 1);
};
Egg.prototype.Initialize = function (dataSrc) {
this.motionSet(0.2, 5, 0.006, 75, q.scl);
this.arrange();
q.head.z = q.head.altitude();
};
Egg.prototype.run = (Egg.prototype.basicRun = function (target) {
var _local1 = this;
_local1.move(target);
q.headz = q.head.altitude(q.tilt);
q.head.z = q.headz;
_local1.draw();
_local1.setDepth();
});
Egg.prototype.Move = function (target) {
var _local1 = this;
_local1.vMoveData(target);
_local1.tipV(q.tilt);
q.vf = _local1.v + q.tipV;
if ((abs(q.vf) < 0.001) and (q.tipV < 0.001)) {
q.vf = 0;
}
_local1.moveUpdate(_local1.turn, q.vf);
q.dtilt = (-q.vf) / q.head.z;
q.tilt = compress(q.tilt + q.dtilt);
};
Egg.prototype.Draw = function () {
this.locate();
q.center.locateRote();
q.head.locateRote();
q.head.angleSet(this.face, q.tilt);
q.head.draw();
};
beginArc = function (p) {
if (p) {
this.register("Avatar", p, 1);
this.segueswitch = 0;
q.counter = 0;
}
now = EggProps;
q.__proto__ = now;
q.links = new Array(new Link("eggArc", "e"), new Link("boxArc", "x"));
};
beginArc.prototype = new Egg();
beginArc.prototype.Enter = function (letter) {
var _local1 = this;
_local1.x = -60;
_local1.y = 0;
_local1.locate();
_local1.z = 0;
q.tilt = 0;
q.tipV = 0;
q.waitCount = 30;
_local1.iColorshade(3);
_local1.v = _local1.vmax;
_local1.face = (-PI) / 4;
};
beginArc.prototype.atmosphere = function () {
var _local1 = this;
_local1.colorShade(((_local1.colorGrade() * q.routecounter) / 30) + (1 * (1 - (q.routecounter / 30))));
_local1.shadow._alpha = (100 * q.routecounter) / 30;
};
eggArc = function (p) {
now = EggProps;
q.__proto__ = now;
q.links = new Array(new Link("beginArc", "o"), new Link("hopperArc", "h"));
};
eggArc.prototype = new Egg();
eggArc.prototype.Enter = function (letter) {
var _local1 = this;
_local1.z = 0;
q.tilt = PI / 2;
q.tipV = 0;
switch (letter) {
case "o" :
q.tilt = was.tilt;
break;
case "x" :
q.tilt = PI / 2;
_local1.v = 0;
}
_local1.icolorshade(3);
q.waitCount = 300;
};
eggArc.prototype.switchCondition = function (letter) {
if ((abs(cos(q.tilt)) < 0.05) and (abs(sin(this.face)) < 0.75)) {
return(1);
}
};
hopperProperties = function () {
var _local1 = this;
_local1.__proto__ = EggProps;
_local1.id = letterCrunch("h");
_local1.cx = 0.4;
_local1.LW = 7 * _local1.scl;
_local1.LL = 36 * _local1.scl;
_local1.tBmx = PI / 8;
_local1.sF = 0.6;
_local1.cF = 0.15;
_local1.unit = _local1.LL * 1.9;
_local1.tipFactor = 0.5;
_local1.hxo = _local1.r / 2.5;
_local1.hzo = 24 * _local1.scl;
_local1.iz = _local1.LW / 2;
_local1.eyeMod = 0.5;
};
_global.Hopper = function () {
};
Hopper.ptype(Being);
hopper.prototype.arrange = function () {
var _local1 = this;
q.head = new Oval(_local1, q.r, q.YS, 0, 1);
q.center = new Point(_local1);
q.leg = new Limb(_local1, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, 0);
_local1.legSet(q.leg);
q.head.attachTo(q.center);
q.partsList = new Array(q.head, q.leg);
q.head.xyz(q.hxo, 0, q.hzo);
};
Hopper.prototype.Initialize = function () {
var _local1 = this;
_local1.motionSet(0.125, 4, 0.006, 75, q.scl);
_local1.Arrange();
q.loke = new Loke(_local1, "hop", q.leg, q, q.center);
_local1.z = q.iz;
};
Hopper.prototype.run = function () {
var _local1 = this;
if (q.loke.state == 1) {
_local1.MoveData(cursor);
} else {
_local1.face = compress(_local1.face + _local1.turn);
}
_local1.MoveUpdate(0, _local1.v);
var _local2 = _local1.v / _local1.vmax;
if (_local2 > 1) {
_local2 = 1;
}
q.head.x = q.hxo * _local2;
q.leg.base.x = (-q.hxo) * (1 - _local2);
q.loke.sF = (0.5 * now.sF) + ((0.5 * now.sF) * _local2);
q.loke.cF = (0.5 * now.cF) + ((0.5 * now.cF) * _local2);
q.loke.process(_local1.v, _local1.vmax);
_local1.draw();
};
Hopper.prototype.draw = function () {
var _local1 = this;
_local1.locate();
q.center.locateRote(_local1.face);
q.leg.base.locateRote(_local1.face);
q.leg.end.locateRote(_local1.face);
q.leg.drawCurved(_local1.face);
q.head.locateRoteTilt(_local1.face, (-q.loke.tip) * q.tipFactor);
q.head.angleSet(_local1.face, ((-PI) / 2) - (q.loke.tip * q.tipFactor));
q.head.draw();
};
_global.hopperArc = function () {
now = HopperProps;
q.__proto__ = now;
below = EggProps;
q.links = new Array(new Link("eggArc", "e", 20), new Link("StomperArc", "k"));
q.routes = new Array();
this.standardRoutes();
};
hopperArc.ptype(Hopper);
hopperArc.prototype.Enter = function (letter) {
scrole = 1;
q.leg.disappear();
this.legSet(q.leg);
q.waitCount = 300;
};
hopperArc.prototype.switchCondition = function (letter) {
if ((q.loke.osc < (((-PI) / 2) + q.loke.oscAdd)) and (q.loke.osc > ((-PI) / 2))) {
return(1);
}
};
hopperArc.prototype.segueCondition = function () {
if (q.loke.state == 1) {
return(1);
}
};
hopperArc.prototype.segue = function (inc, letter) {
if ((inc > 0.05) and (q.leg.form._visible == 0)) {
q.leg.appear();
}
var _local1 = inc;
q.hxo = now.hxo * _local1;
q.head.z = (now.hzo * _local1) + (((q.r * q.YS) - q.iz) * (1 - _local1));
q.tipFactor = now.tipFactor * _local1;
q.leg.lngth = now.LL * _local1;
q.loke.leg.unit = q.unit * _local1;
q.loke.tBmx = (now.tBmx * _local1) + ((PI / 3) * (1 - _local1));
};
StomperProperties = function () {
var _local1 = this;
_local1.__proto__ = hopperProps;
_local1.footRadius = _local1.r;
_local1.LW = 16 * _local1.scl;
_local1.LL = 50 * _local1.scl;
_local1.hzo = _local1.r / 2;
_local1.fxo = (-_local1.r) / 2;
_local1.fzo = (-_local1.r) / 2;
_local1.unit = _local1.LL * 1.9;
_local1.tBmx = PI / 9;
_local1.sF = 0.5;
_local1.cF = 0.1;
_local1.oscWeight = 0.1;
_local1.tipfactor = 0.5;
_local1.YS = 1;
};
_global.Stomper = function () {
};
Stomper.ptype(Being);
Stomper.prototype.arrange = function () {
var _local1 = this;
q.head = new Oval(_local1, q.r, q.YS, 0, 1);
q.center = new Point(_local1);
q.leg = new Limb(_local1, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, 0);
_local1.legSet(q.leg);
q.head.attachTo(q.center);
q.head.xyz(q.hxo, 0, q.hzo);
q.leg.foot = new Dome(_local1, q.r, 0, 1, 0.5);
q.leg.foot.attachTo(q.leg.end);
q.leg.foot.XYZ(q.fzo, 0, q.fxo);
};
Stomper.prototype.Initialize = function () {
var _local1 = this;
_local1.motionSet(0.18, 5, 0.009, 75, q.scl);
_local1.arrange();
q.loke = new Loke(_local1, "hop", q.leg, q, q.center);
};
Stomper.prototype.run = (Stomper.prototype.basicrun = function (target) {
var _local1 = this;
_local1.Move(target);
q.loke.sF = (0.5 * now.sF) + ((0.5 * now.sF) * (_local1.v / _local1.vmax));
q.loke.cF = (0.5 * now.cF) + ((0.5 * now.cF) * (_local1.v / _local1.vmax));
q.loke.process(_local1.v, _local1.vmax);
q.tipfactor = (now.tipfactor * _local1.v) / _local1.vmax;
_local1.draw();
});
Stomper.prototype.draw = function () {
var _local1 = this;
_local1.locate();
q.center.locateRote(_local1.face);
q.head.locateRoteTilt(_local1.face, (-q.tip) / 2);
if (q.ys != 1) {
q.head.angleSet(_local1.face, ((-PI) / 2) - (q.loke.tip * q.tipFactor));
}
q.head.draw();
q.head.setDepth();
_local1.drawDomeLeg(q.leg, 1);
q.leg.foot.shadow._alpha = 100 - ((q.leg.foot.pz - filmspace.pz) * 4);
};
_global.stomperArc = function () {
now = StomperProps;
q.__proto__ = now;
below = HopperProps;
q.links = new Array(new Link("hopperArc", "h", 30), new Link("jumperArc", "j"));
};
stomperArc.ptype(Stomper);
stomperArc.prototype.enter = function (letter) {
q.varlist = new Array("LW", "LL", "hzo", "cx", "cf", "sf", "tbmx", "unit", "fxo", "YS");
q.loke.lokeSync(was.loke);
q.loke.leg.ankle.xyzMatch(was.loke.leg.ankle);
q.waitCount = 300;
};
stomperArc.prototype.segue = function (inc, letter) {
this.HopperToStomper(inc);
};
stomperArc.prototype.segueCondition = function (letter) {
if (q.loke.state == 1) {
return(1);
}
};
stomperArc.prototype.switchCondition = function (letter) {
if ((q.loke.osc < (((-PI) / 2) + q.loke.oscAdd)) and this.sideView()) {
return(1);
}
};
stomperArc.prototype.exit = function () {
q.ovmax = this.vmax;
};
stomperArc.prototype.HopperToStomper = function (inc) {
var _local1 = inc;
segStack(q.varlist, _local1);
q.loke.VarSuck(q);
this.legSet(q.leg);
q.leg.foot.r = (q.footRadius * _local1) + ((q.LW / 2) * (1 - _local1));
q.leg.foot.z = q.loke.fxo * _local1;
q.leg.foot.x = ((q.fzo + below.iz) * _local1) - below.iz;
q.head.YS = q.YS;
q.head.z = q.hzo;
q.head.shadow._alpha = 100 * (1 - _local1);
q.iz = (this.z = -q.leg.foot.x);
};
_global.stomperCrowdArc = function () {
now = StomperProps;
q.__proto__ = now;
below = HopperProps;
q.links = new Array(new Link("TriWalkerArc", "y"), new Link("spinnerArc", "v"));
};
stomperCrowdArc.ptype(Stomper);
stomperCrowdArc.prototype.enter = function (letter) {
var _local3 = this;
if (!(letter === "y")) {
} else {
q.mocklegs = new Array(new MockLeg(_local3.parent, was.mockLegs[2]));
was.mocklegs.splice(2, 1);
n = 0;
while (n < 2) {
var _local2 = q.mockLegs.length;
var _local1 = 0;
m = 0;
while (m < _local2) {
if (was.mockLegs[n].leg.py < q.mocklegs[m].leg.py) {
_local1 = m + 1;
}
m++;
}
q.mocklegs.splice(_local1, 0, new MockLeg(_local3.parent, was.mockLegs[n]));
n++;
}
q.state = 0;
q.leg.lngth = q.leg.lngth * 0.75;
q.loke.leg.unit = q.loke.leg.unit * 0.75;
_local3.iColorShade(3);
_local3.z = -q.leg.foot.x;
q.targetPt = new Point(_local3.parent);
q.newhead = new ball(_local3.parent, was.newhead.r, 0, 1, 0.95, 0.7);
q.newhead.xyzMatch(was.newHead);
q.newhead.face = was.newhead.face;
q.newhead.locate();
q.newhead.draw();
q.newhead.setDepth();
q.newhead.eyes = new eyes(q.newhead, q.r, was.eyeR, "loop");
q.newhead.eyes.draw(q.newhead.face);
q.newhead.shape.setDepth();
q.newhead.eyes.setDepth();
q.newHead.icolorShade(3);
q.newHead.colorShade(q.newHead.colorGrade());
_local3.disappear();
}
};
stomperCrowdArc.prototype.segue = function (inc, letter) {
switch (letter) {
case "y" :
var _local1 = scurve(inc);
q.leg.lngth = (now.ll * _local1) + (was.ll * (1 - _local1));
q.loke.leg.unit = (q.loke.unit = (now.unit * _local1) + (was.unit * (1 - _local1)));
q.leg.LW = (now.lw * _local1) + (was.lw * (1 - _local1));
q.loke.fxo = (q.leg.foot.z = (now.fxo * _local1) + (was.fxo * (1 - _local1)));
q.loke.fzo = (q.leg.foot.x = (now.fzo * _local1) + (was.fzo * (1 - _local1)));
q.head.x = (q.hxo * _local1) + (was.hxo * (1 - _local1));
q.head.z = (q.hzo * _local1) + (was.hzo * (1 - _local1));
q.head.y = q.hyi * (1 - _local1);
q.iz = (this.z = -q.leg.foot.x);
return;
default :
}
};
stomperCrowdArc.prototype.segueCondition = function (letter) {
return(1);
};
stomperCrowdArc.prototype.switchCondition = function (letter) {
trace(letter);
if (q.state == 2) {
return(1);
}
};
stomperCrowdArc.prototype.run = function (letter) {
var _local1 = this;
switch (q.state) {
case 0 :
n = 0;
while (n < 3) {
q.mockLegs[n].sway();
q.mockLegs[n].draw();
n++;
}
q.timer = q.timer + 0.025;
if (q.timer >= 1) {
q.state = 1;
q.timer = 0;
}
return;
case 1 :
n = 0;
while (n < q.mockLegs.length) {
q.mockLegs[n].sway();
n++;
}
q.timer = q.timer + 0.025;
if (q.timer > 0) {
q.mockLegs[0].head.r = ((q.LW / 2) * (1 - q.timer)) + (q.r * q.timer);
q.mockLegs[0].head.x = now.hxo * q.timer;
q.mockLegs[0].head.z = now.hzo * q.timer;
q.mockLegs[0].crunch(q.timer);
}
_local1.shadow._alpha = 100 * (1 - q.timer);
if (q.timer >= 1) {
if (q.mockLegs.length == 0) {
q.state = 2;
} else {
_local1.appear();
q.timer = -1;
_local1.x = q.mockLegs[0].leg.x;
_local1.y = q.mockLegs[0].leg.y;
_local1.face = q.mockLegs[0].face;
q.loke.leg.ankle.XYZ(0, 0, 0);
_local1.v = 0;
q.loke.osc = 0;
q.loke.state = 1;
q.ColorShadeBase = q.mockLegs[0].foot.colorGrade();
q.mockLegs[0].disappear();
q.mockLegs.splice(0, 1);
if (_local1.x < q.newHead.x) {
q.targetPt.x = -1000;
} else {
q.targetPt.x = 1000;
}
q.targetPt.y = 1000;
q.targetPt.locate();
}
}
if (q.mockLegs.length < 3) {
_local1.basicRun(q.targetPt);
}
n = 0;
while (n < q.mockLegs.length) {
q.mockLegs[n].draw();
n++;
}
_local1.setDepth();
return;
case 2 :
}
};
stomperCrowdArc.prototype.atmosphere = function () {
if (q.mockLegs.length < 3) {
if (q.timer > 0) {
var _local1 = (1 - q.ColorShadeBase) * q.timer;
} else {
var _local1 = 0;
}
this.colorShade(q.ColorShadeBase + _local1);
}
};
_global.Jumper = function () {
};
JumperProperties = function () {
var _local1 = this;
_local1.__proto__ = stomperProps;
_local1.hipOff = _local1.r - (_local1.LW / 2);
_local1.fxo = ((-_local1.r) * 1) / 4;
_local1.fzo = ((-_local1.r) * 3) / 4;
_local1.tbmx = PI / 6;
_local1.tipFactor = 1;
_local1.LL = 52 * _local1.scl;
_local1.hxo = 0;
_local1.sf = 0.6;
};
Jumper.ptype(Being);
Jumper.prototype.arrange = function () {
var _local2 = this;
q.head = new Circle(_local2, q.r, 0, 0);
q.center = new Point(_local2);
q.head.attachTo(q.center);
q.head.z = q.hzo;
q.legs = new Array(new Limb(_local2, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, 0), new Limb(_local2, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, 0), new Limb(_local2, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, 0));
n = 0;
while (n < 2) {
var _local1 = q.legs[n];
_local2.legSet(_local1);
_local1.foot = new Dome(_local2, q.r, 0, 1, 0.5);
_local1.foot.attachTo(_local1.end);
_local1.foot.XYZ(q.fzo, 0, q.fxo);
n++;
}
};
Jumper.prototype.Initialize = function () {
var _local1 = this;
_local1.motionSet(0.13, 7.5, 0.009, 75, q.scl);
_local1.arrange();
q.loke = new Loke(_local1, "run", q.legs, q, q.center);
q.loke.airLegFlex = q.loke.JumpAirLegFlex;
};
Jumper.prototype.run = function (target) {
var _local1 = this;
q.czi = q.center.z;
_local1.Move(cursor);
q.loke.process(_local1.v, _local1.vmax);
q.cycle = q.loke.cycle + PI;
var cgravX = ((q.legs[0].end.x + q.legs[1].end.x) / 2);
var cgravY = ((q.legs[0].end.y + q.legs[1].end.y) / 2);
var cgravZ = ((q.legs[0].end.z + q.legs[1].end.z) / 2);
q.head.x = q.hxo;
q.head.y = 0;
q.head.z = q.hzo;
if (q.activeLink.letter == "t") {
var _local2 = q.hzo;
} else {
var _local2 = q.hzo * q.segfactor;
}
q.legs[0].base.x = (-cos(q.cycle)) * q.hipOff;
q.legs[0].base.z = (sin(q.cycle) * q.hipOff) + _local2;
q.legs[1].base.x = cos(q.cycle) * q.hipOff;
q.legs[1].base.z = ((-sin(q.cycle)) * q.hipOff) + _local2;
if ((q.segueSwitch == -1) and ((q.loke.state == 2) or (q.loke.aleg == q.loke.legs[1]))) {
if (q.activeLink.letter == "y") {
_local1.tune(q.legs[0].end, was.fi, q.segfactor);
_local1.tune(q.legs[0].base, was.bi, q.segfactor);
_local1.tune(q.legs[1].base, was.bi2, q.segfactor);
q.legs[0].footTip = (was.ftipi * (1 - q.segfactor)) + (q.legs[0].footTip * q.segfactor);
}
}
_local1.draw();
};
Jumper.prototype.draw = function () {
var _local1 = this;
_local1.locate();
q.center.locateRote(_local1.face);
q.head.locateRote(_local1.face);
q.head.draw();
q.head.setDepth();
_local1.drawDomeLeg(q.legs[0]);
_local1.drawDomeLeg(q.legs[1]);
n = 0;
while (n < 2) {
q.legs[n].foot.shadow._alpha = 100 - ((q.legs[n].foot.pz - filmspace.pz) * 4);
n++;
}
};
_global.jumperArc = function () {
now = JumperProps;
q.__proto__ = now;
below = StomperProps;
q.links = new Array(new Link("stomperArc", "k", 16), new Link("triwalkerArc", "y", 9, 4));
this.standardRoutes();
};
jumperArc.ptype(Jumper);
jumperArc.prototype.enter = function (letter) {
q.varlist = new Array("tbmx", "r", "fxo", "fzo", "LL", "hipOff", "hxo");
q.loke.match(was.loke);
q.loke.time = PI;
q.waitCount = 300;
};
jumperArc.prototype.segue = function (inc, letter) {
var _local2 = inc;
var _local3 = this;
switch (letter) {
case "k" :
q.segFactor = scurve(_local2);
segStack(q.varList, q.segFactor);
q.loke.varSuck(q);
if (_local2 <= 0.5) {
var _local1 = sqrt(_local2 * 2);
q.loke.legs[1].unit = now.unit * _local1;
q.legs[1].weight = now.LW / 2;
q.legs[1].lngth = now.LL * _local1;
q.legs[1].cx = now.cx * _local1;
q.legs[1].foot.r = 0;
} else {
var _local1 = sqrt((_local2 - 0.5) * 2);
q.legs[1].weight = (now.LW / 2) + ((q.LW / 2) * _local1);
q.legs[1].foot.z = now.fxo * _local1;
q.legs[1].foot.x = now.fzo * _local1;
q.legs[1].foot.r = now.footRadius * _local1;
q.loke.legs[1].unit = now.unit;
q.legs[1].lngth = now.LL;
q.legs[1].cx = now.cx;
}
_local3.v = (_local3.vmax * q.segFactor) + (was.ovmax * (1 - q.segFactor));
q.head.r = q.r;
q.legs[0].lngth = q.LL;
q.legs[0].foot.XYZ(q.fzo, 0, q.fxo);
_local3.z = (q.iz = -q.legs[0].foot.x);
return;
case "y" :
q.segFactor = scurve(sqrt(_local2));
if (!((_local2 == 1) and (q.segueSwitch == -1))) {
break;
}
q.loke.process = q.loke.regProcess;
}
};
Being.prototype.sideView = function () {
if (abs(sin(this.face)) < 0.8) {
return(1);
}
};
jumperArc.prototype.switchCondition = function (letter) {
if ((((q.loke.osc > ((-PI) / 2)) and (q.loke.osc < (((-PI) / 2) + q.loke.oscAdd))) and (q.loke.aleg == q.loke.legs[0])) and (abs(sin(this.face)) < 0.4)) {
return(1);
}
};
jumperArc.prototype.exit = function (letter) {
if (!(letter === "y")) {
} else {
q.czv = q.center.z - q.czi;
q.hi = new XYZarray(q.head);
q.fi = new XYZarray(q.legs[1].end);
q.bi = new XYZarray(q.legs[1].base);
q.ftipi = q.legs[1].footTip;
}
};
_global.TriWalker = function () {
};
TriWalkerProperties = function () {
var _local1 = this;
_local1.__proto__ = JumperProps;
_local1.tBmx = PI / 3;
_local1.unit = ((95 * _local1.scl) + _local1.r) - _local1.lw;
_local1.sf = 0.2;
_local1.cycle = 0;
_local1.eyeR = _local1.r / 8;
};
TriWalker.ptype(Being);
triWalker.prototype.Arrange = function () {
var _local2 = this;
q.head = new Circle(_local2, q.r, 0, 0);
q.center = new Point(_local2);
q.head.attachTo(q.center);
q.legs = new Array();
q.legs[0] = new Limb(_local2, now.LW, 0, new Point(q.center), new Point(q.center), new Point(q.center), q.ll, q.cx);
q.legs[1] = new Limb(_local2, now.LW, 0, new Point(q.center), new Point(q.center), new Point(q.center), q.ll, q.cx);
q.legs[2] = new Limb(_local2, now.LW, 0, new Point(q.center), new Point(q.center), new Point(q.center), q.ll, q.cx);
n = 0;
while (n < 3) {
var _local1 = q.legs[n];
_local1.foot = new Dome(_local2, q.r, 0, 1, 0.5);
_local1.foot.attachTo(_local1.end);
_local1.foot.XYZ(q.fzo, 0, q.fxo);
n++;
}
q.eyes = new eyes(_local2, q.r, q.eyeR, "loop");
q.eyes.attachTo(q.head);
};
TriWalker.prototype.Initialize = function () {
var _local1 = this;
_local1.arrange();
_local1.motionSet(0.2, 7.5, 0.011, 75, q.scl);
q.loke = new Loke(_local1, "tri", q.legs, q, q.center);
};
TriWalker.prototype.run = (TriWalker.prototype.basicRun = function (target) {
var _local1 = this;
q.czi = q.center.z;
_local1.MoveData(target);
var _local2 = cos(_local1.turn);
_local1.v = _local1.v * (((_local2 * _local2) * _local2) * _local2);
_local1.MoveUpdate(_local1.turn, _local1.v);
q.loke.process(_local1.v);
var _local3 = q.loke.cycle;
var cycle1 = (q.loke.cycle + ((2 * PI) / 3));
var cycle2 = (q.loke.cycle + ((4 * PI) / 3));
q.legs[0].base.x = cos(_local3) * q.hipOff;
q.legs[0].base.z = ((-sin(_local3)) * q.hipOff) + q.hzo;
q.legs[1].base.x = cos(cycle2) * q.hipOff;
q.legs[1].base.z = ((-sin(cycle2)) * q.hipOff) + q.hzo;
q.legs[2].base.x = cos(cycle1) * q.hipOff;
q.legs[2].base.z = ((-sin(cycle1)) * q.hipOff) + q.hzo;
q.head.x = 0;
q.head.y = 0;
q.head.z = q.hzo;
if (q.segueSwitch == -1) {
_local1.tune(q.legs[1].end, was.fi, q.segfactor);
_local1.tune(q.legs[1].base, was.bi, q.segfactor);
q.legs[1].footTip = (was.ftipi * (1 - q.segfactor)) + (q.legs[1].footTip * q.segfactor);
}
_local1.draw();
});
TriWalker.prototype.draw = function () {
var _local1 = this;
_local1.locate();
q.center.locateRote(_local1.face);
q.head.locateRote(_local1.face);
q.head.draw();
q.head.setDepth();
q.eyes.draw(_local1.face);
n = 0;
while (n < 3) {
_local1.drawDomeLeg(q.legs[n]);
q.legs[n].foot.shadow._alpha = 100 - ((q.legs[n].foot.pz - filmspace.pz) * 4);
n++;
}
};
_global.TriwalkerArc = function () {
now = TriWalkerProps;
q.__proto__ = now;
below = JumperProps;
q.links = new Array(new Link("jumperArc", "j", 12, 22), new Link("stomperCrowdArc", "n"));
};
TriwalkerArc.ptype(TriWalker);
TriwalkerArc.prototype.Enter = function () {
q.state = 0;
q.loke.lokeSync(was.loke);
q.loke.aLeg = q.loke.legs[0];
q.loke.iLegA = q.loke.legs[1];
q.loke.iLegB = q.loke.legs[2];
q.loke.aLeg.ankle.XYZmatch(was.loke.aleg.ankle);
q.loke.aLeg.footTip = PI / 2;
q.loke.iLegA.ankle.iXYZmatch(was.loke.ileg.ankle);
q.loke.LegA.ankle.XYZmatch(was.loke.ileg.ankle);
q.loke.process = q.loke.processJT;
q.waitCount = 500;
};
TriwalkerArc.prototype.segue = function (inc, letter) {
var _local2 = inc;
if (!(letter === "j")) {
} else {
q.segfactor = scurve(_local2);
q.eyes.setEyeRadius(q.eyeR * _local2);
q.loke.legs[0].unit = (q.unit * q.segfactor) + (below.unit * (1 - q.segfactor));
q.loke.legs[1].unit = (q.unit * q.segfactor) + (below.unit * (1 - q.segfactor));
q.loke.unit = (q.unit * q.segfactor) + (below.unit * (1 - q.segfactor));
if (_local2 <= 0.5) {
var _local1 = sqrt(_local2 * 2);
q.loke.legs[2].unit = now.unit * _local1;
q.legs[2].weight = now.LW / 2;
q.legs[2].lngth = now.LL * _local1;
q.legs[2].cx = now.cx * _local1;
q.legs[2].foot.r = 0;
} else {
var _local1 = sqrt((_local2 - 0.5) * 2);
q.legs[2].weight = (now.LW / 2) + ((now.LW / 2) * _local1);
q.legs[2].foot.z = now.fxo * _local1;
q.legs[2].foot.x = now.fzo * _local1;
q.legs[2].foot.r = now.footRadius * _local1;
}
if ((_local2 == 1) and (q.segueSwitch == -1)) {
q.loke.process = q.loke.regProcess;
}
}
};
TriwalkerArc.prototype.switchCondition = function (letter) {
var _local1 = this;
switch (letter) {
case "j" :
if (((((q.loke.aleg == q.loke.legs[0]) and (q.loke.osc < (((-PI) / 2) + q.loke.oscAdd))) and (q.loke.osc > ((-PI) / 2))) and _local1.sideView()) and (_local1.v > (_local1.vmax * 0.95))) {
return(1);
}
return(undefined);
case "n" :
if (q.state == 3) {
return(1);
}
if (!((q.loke.aleg == q.loke.legs[0]) and (q.loke.osc < (((-PI) / 2) + q.loke.oscAdd)))) {
break;
}
scrole = 0;
if ((cos(_local1.face) > 0) and (_local1.x < 0)) {
q.targetPt = new Point(_local1);
q.targetPt.x = 1000;
q.targetPt.locate();
q.mockLegs = new Array();
q.state = 1;
} else {
if (!((cos(_local1.face) < 0) and (_local1.x > 0))) {
break;
}
q.targetPt = new Point(_local1);
q.targetPt.x = -1000;
q.targetPt.locate();
q.mockLegs = new Array();
q.state = 1;
}
}
return(undefined);
};
TriwalkerArc.prototype.Exit = function () {
q.czv = q.center.z - q.czi;
q.hi = new XYZarray(q.head);
q.fi = new XYZarray(q.legs[0].end);
q.bi = new XYZarray(q.legs[0].base);
q.bi2 = new XYZarray(q.legs[1].base);
q.ftipi = q.legs[0].footTip;
};
TriwalkerArc.prototype.atmosphere = function () {
};
TriwalkerArc.prototype.run = function () {
var _local1 = this;
switch (q.state) {
case 0 :
_local1.basicRun(cursor);
_local1.ColorShade(_local1.colorGrade());
return;
case 1 :
var _local2 = q.mockLegs.length;
if ((q.loke.aleg == q.loke.legs[_local2]) and (q.loke.osc > ((PI / 2) - (q.loke.oscAdd * 1.2)))) {
q.legs[_local2].disappear();
q.legs[_local2].foot.disappear();
q.mocklegs[_local2] = new MockLeg(_local1.parent, q.legs[_local2], _local1.face);
q.mocklegs[_local2].setDepth(q.mocklegs[_local2].leg.end);
}
n = 0;
while (n < q.mockLegs.length) {
q.mocklegs[n].sway();
q.mocklegs[n].draw();
n++;
}
if (q.mockLegs.length == 3) {
q.state = 2;
q.head.disappear();
q.eyes.disappear();
q.newhead = new ball(_local1.parent, q.r, 0, 1, 0.95, 0.7);
q.newHead.face = _local1.face;
q.newHead.x = q.head.px - filmspace.px;
q.newHead.y = q.head.py - filmspace.py;
q.newHead.z = q.head.pz - filmspace.pz;
q.newHead.hdx = q.hdx;
q.newHead.hdy = q.hdy;
q.newHead.hdz = q.hdz;
q.newHead.endTimeSort();
q.newHead.run();
q.newHead.shadow._alpha = 0;
q.nhZi = q.newHead.z;
q.newHead.setDepth();
q.newHead.eyes = new eyes(q.newHead, q.r, q.eyeR, "loop");
q.newHead.eyes.draw(_local1.face);
q.newHead.shape.setDepth();
q.newHead.eyes.setDepth();
q.newHead.iColorShade(3);
q.newHead.ColorShade(q.newHead.colorGrade());
dusttarget = q.newHead;
} else {
var hxi = q.head.px;
var hyi = q.head.py;
var _local3 = q.head.pz;
_local1.basicRun(cursor);
q.hdx = q.head.px - hxi;
q.hdy = q.head.py - hyi;
q.hdz = q.head.pz - _local3;
}
_local1.ColorShade(_local1.colorGrade());
return;
case 2 :
n = 0;
while (n < 3) {
q.mocklegs[n].sway();
q.mocklegs[n].draw();
n++;
}
q.newHead.run();
q.newHead.shadow._alpha = (100 * (q.nhZi - q.newHead.z)) / (q.nhZi - q.newHead.r);
q.newhead.eyes.draw(q.newHead.face);
q.newHead.shape.setDepth();
q.newHead.eyes.setDepth();
q.newHead.ColorShade(q.newHead.colorGrade());
if (q.newHead.z == q.newHead.r) {
q.state = 3;
}
return;
case 3 :
}
};
Loke.prototype.ProcessJT = function (v, vm) {
var _local1 = this;
_local1.prepare(v);
_local1.model(_local1.v, vm);
was.czv = was.czv / 1.2;
was.loke.cz = was.loke.cz + was.czv;
var _local2 = (was.loke.cz * (1 - q.segfactor)) + (_local1.cz * q.segfactor);
_local1.aleg.ankle.z = _local1.aleg.ankle.z - (_local2 - _local1.cz);
_local1.cz = _local2;
_local1.transmit();
};
Spinner = function () {
};
Spinner.prototype = new Being();
SpinnerProperties = function () {
var _local1 = this;
_local1.__proto__ = PodRollerProps;
_local1.id = "Spinner";
_local1.spinRate = 0.3;
_local1.baseTilt = 0.1;
_local1.hzo = _local1.bodyLength;
_local1.wanderSpin = 0.1;
};
Spinner.prototype.build = function () {
var _local2 = this;
q.head = new Oval(_local2, q.r, q.ys, 0, 1);
q.fulcrum = new Point(q.head);
q.torso = new Bridge(_local2, q.head, q.fulcrum, q.torsoLW, 0, 1);
q.eyes = new Array(new Loop(_local2, "eye", q.eyer, q.ww, 5), new Loop(_local2, "eye", q.eyer, q.ww, 5));
n = 0;
while (n <= 1) {
var _local1 = (n - 0.5) * 2;
q.eyes[n].xi = q.head.r * _local1;
q.eyes[n].attachTo(q.head);
n++;
}
};
Spinner.prototype.Initialize = function (p) {
var _local1 = this;
_local1.build();
_local1.motionSet(0.08, 5, 0.01, 100, 0.15);
q.torso.draw = q.torso.bridgeSimple;
q.tilt = 0.01;
q.head.z = q.hzo;
q.fulcrum.z = -q.hzo;
q.iz = q.torsoLW / 2;
_local1.icolorShade(3);
};
Spinner.prototype.run = function () {
var _local1 = this;
_local1.arrange();
_local1.draw();
_local1.ColorShade(_local1.colorGrade());
};
Spinner.prototype.arrange = function () {
var _local2 = this;
_local2.z = q.iz;
q.tilt = q.baseTilt;
q.spin = q.spin + q.spinRate;
_local2.turn = q.wanderSpin;
_local2.face = _local2.face + _local2.turn;
q.spin = q.spin - _local2.turn;
q.head.z = cos(q.tilt) * q.hzo;
n = 0;
while (n <= 1) {
var _local1 = q.spin;
q.eyes[n].XYZ(cos(_local1) * q.eyes[n].xi, sin(_local1) * q.eyes[n].xi, q.eys[n].z);
q.eyes[n].face = (-_local1) + (PI * (n + 1));
n++;
}
};
Spinner.prototype.Draw = function () {
var _local2 = this;
_local2.locate();
q.head.locateRote();
q.fulcrum.locateRoteTilt(_local2.face + PI, q.tilt);
q.head.angleSet(_local2.face + PI, q.tilt + (PI / 2));
q.head.draw();
n = 0;
while (n <= 1) {
var _local1 = q.eyes[n];
_local1.locateRoteTilt(_local2.face + PI, q.tilt);
_local1.draw(((-_local1.face) + _local2.face) + PI, q.tilt * cos(_local1.face));
_local1.setDepth();
n++;
}
q.torso.draw();
q.head.setDepth(q.head);
q.torso.fore(q.head);
};
SpinnerArc = function () {
now = SpinnerProps;
q.__proto__ = now;
below = PodRollerProps;
q.links = new Array(new Link("PodRollerArc", "p", 30), new Link("StomperCrowdArc", "n", 200));
};
SpinnerArc.prototype = new Spinner();
SpinnerArc.prototype.Enter = function (letter) {
var _local1 = this;
switch (letter) {
case "p" :
_local1.v = 0;
q.baseTilt = 0;
q.spin = PI / 2;
q.dtilt = was.addOsc;
q.zeroTilt = was.tilt + ((3 * PI) / 2);
q.addTilt = 0;
q.torso.draw = q.torso.bridgesimpleOval;
q.arms = 1;
return;
case "n" :
_local1.xyzMatch(was.newHead);
_local1.v = 0;
_local1.face = was.newHead.face;
q.spin = PI / 2;
q.torso.draw = q.torso.bridgesimpleOval;
q.head.r = was.head.r;
q.head.YS = 1;
q.hzo = was.head.r;
q.fulcrum.z = -q.hzo;
q.torso.LW = (q.torsoLW = 0);
_local1.z = (q.iz = 0);
q.baseTilt = 0;
dusttarget = _local1;
q.eyes[0].xi = -q.head.r;
q.eyes[1].xi = q.head.r;
q.waitCount = 300;
q.arms = 0;
}
};
SpinnerArc.prototype.segue = function (inc, letter) {
var _local2 = inc;
var _local3 = this;
var _local1 = (q.segfactor = scurve(_local2));
switch (letter) {
case "p" :
q.wanderSpin = now.wanderSpin * _local2;
q.spinRate = (now.spinRate * _local1) + (was.spinrate * (1 - _local1));
q.baseTilt = (now.basetilt * _local1) + 0.0001;
_local3.vmax = (q.vi * _local1) + 0.0001;
break;
case "n" :
_local3.slowSwitch = 1;
q.eyes[1].r = (q.eyes[0].r = (was.newHead.eyes.r * (1 - _local1)) + (q.eyer * _local1));
if (_local2 > 0.5) {
sinc2 = scurve((_local2 * 2) - 1);
q.torsolw = (q.torso.lw = now.torsoLW * sinc2);
q.head.r = (now.r * sinc2) + (was.r * (1 - sinc2));
q.head.YS = (now.ys * sinc2) + (1 - sinc2);
q.hzo = (now.hzo * sinc2) + ((q.head.r * q.head.ys) * (1 - sinc2));
q.fulcrum.z = -q.hzo;
q.iz = q.torsoLW / 2;
q.baseTilt = now.basetilt * sinc2;
q.eyes[0].xi = -q.head.r;
q.eyes[1].xi = q.head.r;
} else {
q.baseTilt = 0;
sinc2 = scurve(_local2 * 2);
q.spinRate = now.spinRate * sinc2;
q.wanderSpin = now.wanderSpin * sinc2;
}
}
_local3.z = (q.iz = q.torsoLW / 2);
};
SpinnerArc.prototype.SwitchCondition = function (letter) {
q.head.draw = q.head.ovalDraw;
q.vi = this.vmax;
return(1);
};
PodRollerProperties = function () {
var _local1 = this;
_local1.__proto__ = EggProps;
_local1.id = letterCrunch("p");
_local1.scl = 0.5;
_local1.lw = 0;
_local1.torsoLW = 2 * _local1.scl;
_local1.bodyLength = 15 * _local1.scl;
_local1.feetR = 2 * _local1.scl;
_local1.r = 7.4 * _local1.scl;
_local1.pedalR = 0;
_local1.YS = 0.7;
_local1.zoff = 0;
_local1.state = 1;
_local1.eyeR = 1 * _local1.scl;
_local1.tipA = 0.0035 * _local1.scl;
};
_global.PodRoller = function () {
};
PodRoller.ptype(Being);
PodRoller.prototype.Arrange = function () {
var _local1 = this;
q.head = new Oval(_local1, q.r, q.YS, 0, 1);
q.fulcrum = new Point(q.head);
q.torso = new Bridge(_local1, q.head, q.fulcrum, q.torsoLW, 0, 1);
q.partsList = new Array(q.head, q.eye1, q.eye2, q.torso);
q.eyes = new eyes(_local1, q.r, q.eyeR, "loop");
q.eyes.attachTo(q.head);
};
PodRoller.prototype.Initialize = function () {
var _local1 = this;
_local1.arrange();
_local1.motionSet(0.12, 4.5, 0.004, 75, 0.15);
q.head.z = q.head.altitude(q.tilt);
q.fulcrum.x = -q.bodylength;
_local1.icolorShade(3);
};
PodRoller.prototype.Run = function (target) {
var _local1 = this;
_local1.MoveData(cursor);
var _local2 = cos(q.tilt);
q.tipV = _local2 * q.tipA;
q.tipV = q.tipV * 98;
q.vf = _local1.v + q.tipV;
_local1.SimpleForm();
_local1.Draw();
};
PodRoller.prototype.SimpleForm = function () {
var _local1 = this;
var _local2 = atan2(q.head.r - (q.torso.lw / 2), -q.fulcrum.x);
var chordLength = (((-sin((PI / 2) - _local2)) * 2) * q.fulcrum.x);
q.baseCycle = PI + (_local2 * 2);
q.tipCycle = PI - (_local2 * 2);
q.addOsc = ((PI * 2) * q.vf) / ((((((q.head.r + (q.head.r * q.head.YS)) / 2) * PI) * 2) * (q.baseCycle / (PI * 2))) + (pyt(q.head.r, q.fulcrum.x) * 2));
q.osc = q.osc + q.addOsc;
if (q.osc > (PI * 2)) {
q.osc = q.osc - (PI * 2);
} else if (q.osc < 0) {
q.osc = q.osc + (PI * 2);
}
q.tilt = (-q.osc) + _local2;
switch (q.state) {
case 1 :
if (q.osc > q.baseCycle) {
q.state = 2;
if (q.addOsc > 0) {
var _local3 = 1 - ((q.osc - q.baseCycle) / q.addOsc);
var tipInc = ((q.osc - q.baseCycle) / q.addOsc);
} else {
var _local3 = 1 - (((PI * 2) - q.osc) / q.addOsc);
var tipInc = (((PI * 2) - q.osc) / q.addOsc);
}
_local1.advance1(_local3);
_local1.advance2(tipInc, q.tilt, q.addOsc);
} else {
_local1.advance1(1);
}
break;
case 2 :
if (q.osc > q.baseCycle) {
_local1.advance2(1, q.tilt, q.addOsc);
} else {
q.state = 1;
if (q.osc < (q.baseCycle / 2)) {
var _local3 = q.osc / q.addOsc;
var tipInc = (1 - _local3);
} else {
var _local3 = (q.baseCycle - q.osc) / q.addOsc;
var tipInc = (1 - _local3);
}
_local1.advance2(tipInc, _local2, q.addOsc);
_local1.advance1(_local3);
}
}
if (q.state == 1) {
q.head.z = q.head.altitude(q.tilt);
_local1.z = 0;
} else {
_local1.z = (((-sin(q.tilt)) * q.fulcrum.x) - q.head.z) + (q.torso.lw / 2);
}
q.cvpt.x = -(q.zoff / 2);
};
PodRoller.prototype.advance1 = function (inc) {
var _local1 = this;
var _local2 = inc;
_local1.face = compress(_local1.face + (_local1.turn * _local2));
_local1.x = _local1.x + (((cos(_local1.face) * q.vf) * cos(_local1.turn)) * _local2);
_local1.y = _local1.y + (((sin(_local1.face) * q.vf) * cos(_local1.turn)) * _local2);
};
PodRoller.prototype.advance2 = function (inc, angle, dAngle) {
var _local1 = this;
var _local2 = angle;
var _local3 = inc;
_local1.face = compress(_local1.face + (_local1.turn * _local3));
var vf = (((-sin(dAngle)) * sin(_local2)) * q.fulcrum.x);
_local1.x = _local1.x + ((cos(_local1.face) * vf) * _local3);
_local1.y = _local1.y + ((sin(_local1.face) * vf) * _local3);
var tx = ((q.fulcrum.x * cos(_local2)) * cos(_local1.face - (_local1.turn * _local3)));
var ty = ((q.fulcrum.x * cos(_local2)) * sin(_local1.face - (_local1.turn * _local3)));
_local1.x = _local1.x + (tx - ((q.fulcrum.x * cos(_local2)) * cos(_local1.face)));
_local1.y = _local1.y + (ty - ((q.fulcrum.x * cos(_local2)) * sin(_local1.face)));
};
PodRoller.prototype.Draw = function () {
var _local1 = this;
_local1.locate();
q.head.locate();
q.fulcrum.locateRoteTilt(_local1.face, q.tilt);
q.head.angleSet(_local1.face, q.tilt);
q.head.draw();
q.torso.bridgeSimpleOval();
q.torso.bridgeShadow();
q.head.setDepth();
q.torso.fore(q.head);
if (q.eyes) {
q.eyes.Draw(_local1.face);
}
};
PodRollerArc = function () {
now = PodRollerProps;
q.__proto__ = now;
below = EggProps;
q.links = new Array(new Link("spinnerArc", "v", 5), new Link("handStanderArc", "a"));
};
PodRollerArc.ptype(PodRoller);
PodRollerArc.prototype.Enter = function (letter) {
var _local1 = atan2(q.head.r - (q.torso.lw / 2), -q.fulcrum.x);
q.baseCycle = PI + (_local1 * 2);
q.tipCycle = PI - (_local1 * 2);
this.face = (was.spin + this.face) + (PI / 2);
q.osc = q.baseCycle + (q.tipCycle / 2);
q.tilt = 0;
q.state = 2;
q.waitCount = 300;
q.tipa = 0;
};
PodRollerArc.prototype.segue = function (inc, letter) {
var _local1 = scurve(inc);
q.tipA = now.tipA * _local1;
};
PodRollerArc.prototype.switchCondition = function (letter) {
if (q.state == 1) {
return(1);
}
};
HandStanderProperties = function () {
var _local1 = this;
_local1.__proto__ = PodRollerProps;
_local1.id = letterCrunch("h");
_local1.scl = 0.5;
_local1.lw = 1.5 * _local1.scl;
_local1.torsoLW = 1.5 * _local1.scl;
_local1.bodyLength = 23 * _local1.scl;
_local1.feetR = 2 * _local1.scl;
_local1.r = 4.5 * _local1.scl;
_local1.pedalR = 5 * _local1.scl;
_local1.YS = 0.8;
_local1.zoff = 6;
_local1.state = 1;
_local1.land = 0;
_local1.eyeR = 0.7 * _local1.scl;
};
_global.HandStander = function () {
};
HandStander.ptype(PodRoller);
HandStander.prototype.Arrange = function () {
var _local1 = this;
q.head = new Oval(_local1, q.r, q.YS, 0, 1);
q.fulcrum = new Point(q.head);
q.legs = new Point(_local1);
q.legs.attachTo(q.fulcrum);
q.cvpt = new Point(q.legs);
q.torso = new Bridge(_local1, q.head, q.legs, q.torsoLW, 0, 1, q.cvpt);
q.spokes = new Array(new Part(_local1, 0, 0), new Part(_local1, 0, 0), new Part(_local1, 0, 0));
n = 0;
while (n < 3) {
q.spokes[n].iColorBlend(0, 1);
n++;
}
q.foot1 = new Point(q.legs);
q.foot2 = new Point(q.legs);
q.foot3 = new Point(q.legs);
q.cpoint = q.foot1;
q.batchPoints = new Array(q.foot1, q.foot2, q.foot3);
};
HandStander.prototype.Initialize = function () {
var _local1 = this;
_local1.motionSet(0.12, 3.5, 0.004, 75, 0.15);
_local1.Arrange();
q.torso.cvpoint = q.fulcrum;
q.head.z = q.head.altitude(q.tilt);
q.eyes = new eyes(_local1, q.r, q.eyeR, "loop");
q.eyes.attachTo(q.head);
_local1.proportions();
_local1.icolorShade(3);
};
HandStander.prototype.proportions = function () {
q.legOff = q.zoff / 2;
q.footOff = q.zoff / 2;
q.footLength = pyt(q.pedalR, q.footOff);
q.footOpen = atan2(q.footOff, q.pedalR);
q.hz = q.head.altitude(q.tilt);
var _local1 = (q.legOff + q.footOff) - q.hz;
var _local2 = sqrt((q.fulcrum.x * q.fulcrum.x) - (_local1 * _local1));
q.nAngle = atan2(_local1, _local2);
};
HandStander.prototype.Run = function (target) {
var _local1 = this;
_local1.MoveData(cursor);
q.tipV = q.tipV * 0.98;
q.vf = _local1.v + q.tipV;
_local1.SimpleForm();
_local1.Draw();
};
HandStander.prototype.SimpleForm = function () {
q.baseCycle = PI - (q.nAngle * 2);
q.tipCycle = PI + (q.nAngle * 2);
var addOscBase = ((was.addOsc * (1 - q.segfactor)) + ((((q.segfactor * PI) * 2) * q.vf) / ((((((q.head.r + (q.head.r * q.head.YS)) / 2) * PI) * 2) * (q.baseCycle / (PI * 2))) + (pyt(q.head.r, q.fulcrum.x) * 2))));
if (q.state == 1) {
q.addOsc = addOscBase * ((0.666666666666667 * q.segfactor) + (1 - q.segfactor));
} else {
q.addOsc = addOscBase * ((1.33333333333333 * q.segfactor) + (1 - q.segfactor));
}
q.osc = q.osc + q.addOsc;
if (q.osc > (PI * 2)) {
q.osc = q.osc - (PI * 2);
}
q.tilt = (-q.osc) - q.nAngle;
q.hz = q.head.altitude(q.tilt);
switch (q.state) {
case 1 :
if (q.osc > q.baseCycle) {
q.state = 2;
var baseInc = (1 - ((q.osc - q.baseCycle) / q.addOsc));
var tipInc = ((q.osc - q.baseCycle) / q.addOsc);
this.advance1(baseInc);
this.advance2(tipInc, q.tilt, q.addOsc);
} else {
this.advance1(1);
}
break;
case 2 :
q.land = 1;
if (q.osc > q.baseCycle) {
this.advance2(1, q.tilt, q.addOsc);
} else {
q.state = 1;
q.land = 0;
var baseInc = (q.osc / q.addOsc);
var tipInc = (1 - (q.osc / q.addOsc));
this.advance2(tipInc, q.nAngle, q.addOsc);
this.advance1(baseInc);
}
}
if (q.state == 1) {
q.head.z = q.hz;
this.z = 0;
var fac = ((-q.osc) / q.basecycle);
q.feetTilt = (fac * PI) * 2;
q.legs.z = ((-q.legOff) / 2) - ((q.legOff * (1 - abs(sin(PI * fac)))) / 2);
} else {
var fac = ((-(q.osc - q.basecycle)) / q.tipcycle);
var fz = (sin(q.tilt) * q.fulcrum.x);
q.legs.z = ((-q.legOff) / 2) - ((q.legOff * (1 - abs(sin(PI * fac)))) / 2);
this.z = (((-fz) - q.head.z) - q.legs.z) + q.footOff;
q.feetTilt = 0;
q.feetTwist = compress(q.feetTwist - this.turn);
}
var fxco = (q.footLength * cos(q.footOpen));
var fxso = (q.footLength * sin(q.footOpen));
n = 1;
while (n <= 3) {
var foot = eval ("q.foot" + n);
foot.angle = (((n * 2) / 3) * PI) + q.feetTwist;
foot.x = cos(foot.angle) * fxco;
foot.y = sin(foot.angle) * fxco;
foot.z = -fxso;
n++;
}
};
HandStander.prototype.advance2 = function (inc, angle, dAngle) {
var _local1 = this;
var _local3 = inc;
var _local2 = q.fulcrum.x * cos(angle);
_local1.face = _local1.face + (_local1.turn * _local3);
var vf = (((-sin(dAngle)) * sin(angle)) * q.fulcrum.x);
_local1.x = _local1.x + ((cos(_local1.face) * vf) * _local3);
_local1.y = _local1.y + ((sin(_local1.face) * vf) * _local3);
var tx = (_local2 * cos(_local1.face - (_local1.turn * _local3)));
var ty = (_local2 * sin(_local1.face - (_local1.turn * _local3)));
_local1.x = _local1.x + (tx - (_local2 * cos(_local1.face)));
_local1.y = _local1.y + (ty - (_local2 * sin(_local1.face)));
};
HandStander.prototype.advance1 = function (inc) {
var _local1 = this;
var _local3 = inc;
var _local2 = q.addOsc * q.hz;
_local1.face = _local1.face + (_local1.turn * _local3);
_local1.x = _local1.x + (((cos(_local1.face) * _local2) * cos(_local1.turn)) * _local3);
_local1.y = _local1.y + (((sin(_local1.face) * _local2) * cos(_local1.turn)) * _local3);
};
HandStander.prototype.Draw = function () {
this.locate();
q.head.locate();
q.head.angleSet(this.face, q.tilt);
q.fulcrum.locateRoteTilt(this.face, q.tilt);
q.legs.locateRoteTilt(this.face, q.feetTilt);
if ((q.state == 1) or (q.land == 0)) {
q.cpoint.RoteSet(this.face);
q.cpoint.TiltSet(q.feetTilt);
q.cpoint.locateRoteTiltSrc(q.batchPoints);
}
n = 1;
while (n <= 3) {
var drawpath = q.spokes[n - 1].form;
drawpath.clear();
drawpath.lineStyle((q.lw * 10) * q.legs.depth, 0);
path = eval ("q.foot" + n);
drawpath.moveTo(q.legs.vx, q.legs.vy);
drawpath.lineTo(path.vx, path.vy);
q.spokes[n - 1].ColorBlend(cos((path.angle + this.face) - (PI / 2)) * cos(q.feetTilt));
q.spokes[n - 1].setDepth(path);
n++;
}
q.head.draw();
q.torso.bridgeCurvedOval();
q.torso.bridgeShadow();
q.head.setDepth();
q.torso.fore(q.head);
q.eyes.Draw(this.face);
};
HandStanderArc = function () {
now = HandStanderProps;
q.__proto__ = now;
below = PodRollerProps;
q.links = new Array(new Link("PodRollerArc", "p", 200), new Link("rotoArc", "z"));
};
HandStanderArc.prototype = new HandStander();
HandStanderArc.prototype.Enter = function (letter) {
q.osc = was.osc;
q.state = was.state;
q.tipV = was.tipV;
q.waitCount = 500;
};
HandStanderArc.prototype.segue = function (inc, letter) {
var _local1 = scurve(inc);
q.segfactor = _local1;
q.fulcrum.x = ((-q.bodylength) * _local1) - (below.bodylength * (1 - _local1));
q.head.r = (q.r * _local1) + (below.r * (1 - _local1));
q.head.YS = (q.YS * _local1) + (below.YS * (1 - _local1));
q.lw = (now.LW / 2) + ((now.LW * _local1) / 2);
q.pedalR = (now.pedalR * _local1) + (below.pedalR * (1 - _local1));
q.zoff = now.zoff * _local1;
q.eyes.setEyeRadius((now.eyeR * _local1) + (below.eyeR * (1 - _local1)));
q.eyes.setHeadRadius(q.head.r);
this.proportions();
};
HandStanderArc.prototype.segueCondition = function () {
if (q.state == 1) {
return(1);
}
};
HandStanderArc.prototype.switchCondition = function (letter) {
if (((q.state == 1) and (q.osc < (q.basecycle / 2))) and (q.osc > ((q.basecycle / 2) - q.addOsc))) {
return(1);
}
};
rotoProperties = function () {
var _local1 = this;
_local1.__proto__ = HandStanderProps;
_local1.scl = 0.5;
_local1.lw = 1.5 * _local1.scl;
_local1.torsoLW = 1 * _local1.scl;
_local1.bodyLength = 28 * _local1.scl;
_local1.feetR = 1.6 * _local1.scl;
_local1.r = 4 * _local1.scl;
_local1.pedalR = 8.5 * _local1.scl;
_local1.arcLength = sin(PI / 3) * _local1.pedalR;
_local1.czi = (_local1.pedalR - (sin(PI / 6) * _local1.pedalR)) + _local1.feetR;
_local1.headAngleRest = Math.asin(((-_local1.czi) + _local1.r) / _local1.bodyLength);
_local1.eyeR = 0.25;
};
_global.Roto = function () {
};
Roto.ptype(Being);
Roto.prototype.Arrange = function () {
var _local1 = this;
q.head = new Oval(_local1, q.r, q.YS, 0, 1);
q.legs = new Point(_local1);
q.cvpt = new Point(q.head);
q.torso = new Bridge(_local1, q.head, q.legs, q.torsoLW, 0, 1, q.cvpt);
q.foot1 = new Circle(_local1, q.footr, 0, 1);
q.foot2 = new Circle(_local1, q.footr, 0, 1);
q.foot3 = new Circle(_local1, q.footr, 0, 1);
q.spokes = new Part(_local1, 0, 0);
q.head.attachTo(q.legs);
q.foot1.attachTo(q.legs);
q.foot2.attachTo(q.legs);
q.foot3.attachTo(q.legs);
q.partsList = new Array(q.head, q.torso, q.spokes, q.foot1, q.foot2, q.foot3);
};
Roto.prototype.Initialize = function () {
var _local1 = this;
_local1.motionSet(0.03, 1.5, 0.01, 15, q.scl);
_local1.arrange();
q.eyes = new eyes(_local1, q.r, q.eyeR, "loop");
q.eyes.attachTo(q.head);
q.legs.z = q.czi;
q.legs.x = ((-q.bodyLength) * 5) / 6;
q.cvpt.x = -q.bodyLength;
q.head.x = q.bodyLength;
q.head.r = q.r;
_local1.z = 0;
q.foot1.r = q.feetr;
q.foot2.r = q.feetr;
q.foot3.r = q.feetr;
q.state = 1;
};
Roto.prototype.TiltForm = function (dtilt, tilt) {
if (tilt == undefined) {
dtilt = dtilt + atilt;
q.tilt = q.tilt + dtilt;
if (q.tilt > q.headAngleRest) {
q.tilt = q.headAngleRest;
dtilt = 0;
}
} else {
q.dtilt = tilt - q.tilt;
q.tilt = tilt;
}
q.headAngle = q.tilt;
q.cvAngle = q.tilt;
if (q.YS != 1) {
q.legs.z = ((-q.head.x) * sin(q.tilt)) + (q.head.r * ((cos(q.tilt) * cos(q.tilt)) + ((q.head.YS * sin(q.tilt)) * sin(q.tilt))));
} else {
q.legs.z = ((-q.head.x) * sin(q.tilt)) + q.head.r;
}
q.legs.x = 0;
this.v = ((-dtilt) * q.head.r) + ((sin(dtilt) * sin(q.tilt)) * q.head.x);
this.x = this.x + (cos(this.face) * this.v);
this.y = this.y + (sin(this.face) * this.v);
if (this.turn != 0) {
var fac = (1 - ((q.tilt - q.headAngleRest) / (((-PI) / 2) - q.headAngleRest)));
var ix = (this.x - ((((q.bodylength * 5) / 6) * cos(this.face)) * fac));
var iy = (this.y - ((((q.bodylength * 5) / 6) * sin(this.face)) * fac));
this.x = ix + ((((q.bodylength * 5) / 6) * cos(this.face - this.turn)) * fac);
this.y = iy + ((((q.bodylength * 5) / 6) * sin(this.face - this.turn)) * fac);
}
var fac = ((q.tilt - q.headAngleRest) / (((-PI) / 2) - q.headAngleRest));
q.feetTilt = ((-PI) / 2) * fac;
q.feetFace = this.face;
n = 1;
while (n <= 3) {
var foot = eval ("q.foot" + n);
foot.angle = compress(q.feetspin + (((n / 3) * PI) * 2));
foot.x = -q.fzo;
foot.y = q.pedalR * sin(foot.angle);
foot.z = q.pedalR * cos(foot.angle);
n++;
}
};
Roto.prototype.Loke = function () {
q.headAngle = q.headAngleRest;
q.cvAngle = 0;
q.legsV = Pyt(this.v, sin(this.turn) * q.legs.x);
q.spinRate = q.legsV / ((q.arcLength * 6) / (PI * 2));
q.feetSpin = compress(q.feetSpin - q.spinRate);
var oFeetFace = q.feetFace;
if (this.v != 0) {
q.feetFace = this.face + atan2(this.turn * q.legs.x, this.v * cos(this.turn));
var feetTurn = (q.feetFace - oFeetFace);
} else {
q.feetFace = this.face - (PI / 2);
var feetTurn = 0;
}
n = 1;
while (n <= 3) {
var foot = eval ("q.foot" + n);
foot.angle = compress(q.feetspin + (((n / 3) * PI) * 2));
foot.z = (-q.pedalR) * cos(foot.angle);
if (((foot.z + q.legs.z) - q.feetR) < 0) {
var d = (foot.angle / (PI / 3));
foot.x = foot.x - (q.legsV * cos(feetTurn));
foot.y = foot.y - (q.legsV * sin(feetTurn));
var tpx = foot.x;
var tpy = foot.y;
foot.x = (tpx * cos(feetTurn)) + (tpy * sin(feetTurn));
foot.y = (tpy * cos(feetTurn)) - (tpx * sin(feetTurn));
foot.z = q.feetR - q.legs.z;
} else {
foot.x = q.pedalR * sin(foot.angle);
foot.y = foot.y / 2;
}
n++;
}
};
Roto.prototype.Draw = function () {
this.locate();
q.legs.locateRote(this.face);
q.head.locateRoteTilt(this.face, q.headAngle);
if (q.head.ys != 1) {
q.head.angleSet(this.face, q.headAngle);
}
q.cvpt.locateRoteTilt(this.face, q.cvAngle);
n = 1;
while (n <= 3) {
path = eval ("q.foot" + n);
path.locateRoteTilt(q.feetface, q.feetTilt);
if ((path.pz - filmspace.pz) < path.r) {
path.pz = path.r + filmspace.pz;
path.ProjectionData();
}
path.draw();
n++;
}
q.head.draw(this.face, q.tilt);
q.torso.bridgeCurved();
q.torso.bridgeShadow();
q.eyes.draw(this.face);
q.head.setDepth();
q.torso.fore(q.head);
q.spokes.form.clear();
var path = q.spokes.form;
path.lineStyle((q.lw * 10) * q.legs.depth, 0);
path.moveTo(q.legs.vx, q.legs.vy);
path.lineTo(q.foot1.vx, q.foot1.vy);
path.moveTo(q.legs.vx, q.legs.vy);
path.lineTo(q.foot2.vx, q.foot2.vy);
path.moveTo(q.legs.vx, q.legs.vy);
path.lineTo(q.foot3.vx, q.foot3.vy);
};
Roto.prototype.BasicRun = function (target) {
var _local1 = this;
_local1.Move(target);
_local1.Loke();
_local1.draw();
};
rotoArc = function () {
now = RotoProps;
q.__proto__ = now;
below = HandStanderProps;
q.links = new Array(new Link("windMillArc", "w", 60), new Link("handStanderArc", "a", 10));
};
rotoArc.prototype = new Roto();
rotoArc.prototype.Enter = function () {
var _local1 = this;
_local1.face = _local1.face + PI;
q.tilt = -(PI + was.tilt);
q.dtilt = was.addOsc;
q.iLength = (-was.fulcrum.x) - was.legs.z;
q.footTwist = PI / 2;
q.itilt = (-was.feetTilt) - ((3 * PI) / 2);
q.head.draw = q.head.ovalDraw;
_local1.x = (was.head.px - filmspace.px) - ((((5 * q.iLength) / 6) * cos(q.tilt)) * cos(_local1.face));
_local1.y = (was.head.py - filmspace.py) - ((((5 * q.iLength) / 6) * cos(q.tilt)) * sin(_local1.face));
_local1.icolorShade(3);
q.waitcount = 600;
_local1.v = 0;
if (was.feetTwist > ((2 * PI) / 3)) {
was.feetTwist = was.feetTwist - ((2 * PI) / 3);
} else if (was.feetTwist < ((-2 * PI) / 3)) {
was.feetTwist = was.feetTwist + ((2 * PI) / 3);
}
};
rotoArc.prototype.switchCondition = function (letter) {
switch (letter) {
case "w" :
if (q.state == 6) {
return(1);
}
if (this.v > 0) {
q.state = 5;
q.segfactor = 1;
}
return;
default :
return(1);
}
};
rotoArc.prototype.Exit = function () {
};
rotoArc.prototype.Segue = function (inc, letter) {
switch (letter) {
case "a" :
var factor = scurve(inc);
q.fzo = was.footoff * (1 - factor);
q.pedalR = (now.pedalR * factor) + (below.pedalR * (1 - factor));
q.lw = (now.lw * factor) + (below.lw * (1 - factor));
q.head.x = (now.bodyLength * factor) + (q.iLength * (1 - factor));
n = 1;
while (n <= 3) {
var path = eval ("q.foot" + n);
path.r = q.feetR * factor;
n++;
}
q.head.r = (now.r * factor) + (below.r * (1 - factor));
q.head.YS = (1 * factor) + (below.YS * (1 - factor));
q.feetSpin = (-was.feetTwist) * (1 - factor);
if (inc == 1) {
q.head.draw = q.head.circledraw;
}
return;
case "w" :
var factor = scurve(inc);
q.feetTilt = (PI / 2) * factor;
q.eyes.setEyeRadius(q.eyeR * factor);
q.segfactor = factor;
}
};
RotoArc.prototype.Run = function (target) {
switch (q.state) {
case 1 :
q.dtilt = q.dtilt + ((grav * cos(q.tilt)) / 20);
this.TiltForm(q.dtilt);
if (q.tilt == q.headAngleRest) {
q.state = 2;
}
this.Draw();
return;
case 2 :
q.legs.z = q.czi;
q.legs.x = ((-q.bodyLength) * 5) / 6;
q.cvpt.x = -q.bodyLength;
q.head.x = q.bodyLength;
q.head.r = q.r;
this.x = this.x + (((q.bodyLength * cos(this.face)) * 5) / 6);
this.y = this.y + (((q.bodyLength * sin(this.face)) * 5) / 6);
this.z = 0;
q.feetSpin = PI / 3;
q.state = 3;
n = 1;
while (n <= 3) {
var foot = eval ("q.foot" + n);
foot.angle = compress(q.feetspin + (((n / 3) * PI) * 2));
foot.z = (-q.pedalR) * cos(foot.angle);
foot.x = q.pedalR * sin(foot.angle);
foot.y = 0;
n++;
}
this.turn = 0;
this.v = 0;
this.Draw();
case 3 :
if (this.turn > (this.tr * 3)) {
this.v = this.v + this.a;
if (this.v > this.vmax) {
q.state = 4;
}
} else {
this.turn = this.turn + this.tr;
this.turn = this.turn * 0.9;
}
this.moveUpdate(this.turn, this.v);
this.loke();
this.Draw();
return;
case 4 :
this.basicRun(cursor);
return;
case 5 :
this.turn = this.turn + this.tr;
this.turn = this.turn * 0.9;
this.v = this.v - this.a;
if (this.v < 0) {
this.v = 0;
}
if ((this.turn > (this.tr * 7)) and (this.v == 0)) {
q.legs.x = -q.bodyLength;
q.cvpt.x = -q.bodyLength;
q.head.x = q.bodyLength;
this.x = this.x - (((q.bodyLength * cos(this.face)) * 5) / 6);
this.y = this.y - (((q.bodyLength * sin(this.face)) * 5) / 6);
this.z = 0;
n = 1;
while (n <= 3) {
var foot = eval ("q.foot" + n);
foot.angle = compress(q.feetspin + (((n / 3) * PI) * 2));
foot.x = cos(foot.angle) * q.pedalR;
foot.y = sin(foot.angle) * q.pedalR;
foot.z = 0;
n++;
}
q.feetSpin = q.feetSpin + (PI / 3);
q.state = 6;
} else {
this.moveUpdate(this.turn, this.v);
this.loke();
this.Draw();
return;
}
case 6 :
this.face = this.face + this.turn;
q.feetSpin = q.feetSpin - q.spinRate;
this.TiltForm(0, q.headAngleRest + ((((-PI) / 2) - q.headAngleRest) * (1 - q.segfactor)));
this.Draw();
}
};
WindMillProperties = function () {
var _local1 = this;
_local1.__proto__ = RotoProps;
_local1.scl = 0.5;
_local1.bob = 2 * _local1.scl;
_local1.tiltMax = ((-PI) / 2) - 0.1;
_local1.r = 4.8 * _local1.scl;
_local1.bodyLength = 24 * _local1.scl;
_local1.fantilt = (-PI) / 6;
_local1.dropTilt = PI / 3;
_local1.spinRate = PI / 12;
};
_global.WindMill = function () {
};
WindMill.ptype(Being);
being.prototype.WindMillArrange = function () {
var _local1 = this;
q.head = new Circle(_local1, q.r, 0, 1);
q.legs = new Point(_local1);
q.cvpt = new Point(q.legs);
q.torso = new Bridge(_local1, q.head, q.legs, q.torsoLW, 0, 1, q.cvpt);
q.spokes = new Array(new Part(_local1, 0, 0), new Part(_local1, 0, 0), new Part(_local1, 0, 0));
q.feet = new Array(new Circle(_local1, q.feetr, 0, 1), new Circle(_local1, q.feetr, 0, 1), new Circle(_local1, q.feetr, 0, 1));
n = 0;
while (n <= 2) {
q.spokes[n].iColorBlend(0, 1);
q.feet[n].iColorBlend(0, 1);
q.feet[n].attachTo(q.legs);
n++;
}
q.head.attachTo(q.legs);
};
WindMill.prototype.Initialize = function () {
var _local1 = this;
_local1.WindMillArrange();
_local1.motionSet(0.1, 2.8, 0.007, 40, q.scl);
_local1.proportions();
q.lz = 0;
q.tilt = q.tiltMax;
q.legstilt = q.tiltMax;
q.xArray = new Array();
q.yArray = new Array();
q.state = 1;
_local1.restAlt = function () {
var _local1 = (-q.head.z) + q.head.r;
return(_local1);
};
};
WindMill.prototype.proportions = function () {
q.head.z = -q.bodyLength;
q.cvpt.z = (-q.bodyLength) / 2;
};
WindMill.prototype.SimpleForm = function (fantilt, spinRate) {
var _local2 = fantilt;
var _local3 = this;
_local3.osc = _local3.osc + 0.1;
var lift = (cos(_local3.osc) * q.bob);
q.legs.z = lift;
q.spin = q.spin - spinRate;
n = 0;
while (n <= 2) {
var _local1 = q.feet[n];
_local1.angle = q.spin + (((n * 2) / 3) * PI);
_local1.x = (cos(_local1.angle) * q.pedalR) * cos(_local2);
_local1.y = (sin(_local1.angle) * q.pedalR) * cos(_local2);
_local1.z = q.pedalR * sin(_local2);
n++;
}
q.cvptFace = _local3.face;
q.cvptTilt = 0;
var windFactor = (-cos(q.headTilt));
var gravFactor = (-sin(q.headTilt));
q.tiltA = ((windfactor * _local3.v) / 200) + (gravfactor * 0.025);
q.tiltV = q.tiltV + q.tiltA;
q.tiltV = q.tiltV * 0.96;
q.headtilt = q.headtilt + q.tiltV;
q.headface = _local3.face;
};
WindMill.prototype.Draw = function (tilt) {
var _local1 = this;
_local1.locate();
q.legs.locate();
q.head.locateRoteTilt(q.headface, q.headtilt);
q.tiltAngle = atan2(q.cvpt.z, -pyt(q.cvpt.x, q.cvpt.y)) + (PI / 2);
var _local2 = ((_local1.v / _local1.vmax) * PI) / 8;
n = 0;
while (n <= 2) {
path = q.feet[n];
path.locateRoteTilt(_local1.face, -_local2);
path.draw();
n++;
}
q.head.draw(q.headface, q.headtilt + (PI / 2));
q.cvpt.locateRoteTilt(q.cvptface, q.cvpttilt);
q.torso.bridgeCurved();
q.torso.setDepth(q.legs);
n = 0;
while (n <= 2) {
var path = q.spokes[n].form;
path.clear();
path.lineStyle((q.lw * 10) * q.legs.depth, 0);
path.moveTo(q.legs.vx, q.legs.vy);
path.lineTo(q.feet[n].vx, q.feet[n].vy);
q.spokes[n].ColorBlend((1 * cos((q.feet[n].angle + _local1.face) - (PI / 2))) / 2);
q.feet[n].ColorBlend((1 * cos((q.feet[n].angle + _local1.face) - (PI / 2))) / 2);
q.feet[n].setDepth();
q.spokes[n].fore(q.feet[n]);
n++;
}
};
WindMill.prototype.Run = (WindMill.prototype.BasicRun = function (target) {
var _local1 = this;
_local1.vMoveData(cursor);
_local1.moveUpdate(_local1.turn, _local1.v);
_local1.z = q.alt;
_local1.SimpleForm(q.fantilt, q.spinRate, angle);
_local1.draw();
});
WindMillArc = function () {
now = WindMillProps;
q.__proto__ = now;
below = RotoProps;
q.links = new Array(new Link("RotoArc", "z", 60), new Link("BeanBagArc", "b"));
this.standardRoutes();
};
WindMillArc.prototype = new WindMill();
WindMillArc.prototype.Enter = function (letter) {
var _local1 = this;
_local1.z = _local1.restAlt();
q.tilt = 0;
q.spin = was.feetspin;
_local1.v = 0;
q.accel = _local1.a;
q.waitcount = 300;
_local1.icolorShade(3);
};
WindMillArc.prototype.switchCondition = function (letter) {
if (q.state == 1) {
q.state = 2;
} else if (q.state == 4) {
return(1);
}
};
WindMillArc.prototype.Exit = function (letter) {
n = 1;
while (n <= 3) {
var _local1 = q.feet[n];
_local1.ox = _local1.px - q.legs.px;
_local1.oy = _local1.py - q.legs.py;
_local1.oz = _local1.pz - q.legs.pz;
n++;
}
};
WindMillArc.prototype.segue = function (inc, letter) {
var _local2 = this;
var _local1 = scurve(inc);
q.bob = now.bob * _local1;
q.bodylength = (below.bodyLength * (1 - _local1)) + (now.bodyLength * _local1);
q.head.r = (below.r * (1 - _local1)) + (q.r * _local1);
q.fantilt = now.fantilt * _local1;
q.spinRate = (now.spinRate * _local1) + (was.spinRate * (1 - _local1));
_local2.proportions();
q.alt = _local2.restAlt() + (_local1 * 8);
_local2.a = q.accel * _local1;
};
WindMillArc.prototype.Run = function (target) {
var _local1 = this;
switch (q.state) {
case 1 :
_local1.basicRun();
return;
case 2 :
_local1.v = _local1.v - _local1.a;
if (_local1.v < 0) {
_local1.v = 0;
}
if (((_local1.v == 0) and (abs(q.tiltV) < 0.01)) and (abs(q.headtilt) < 0.01)) {
q.oz = _local1.z;
q.state = 3;
}
_local1.turn = _local1.turn * 0.9;
_local1.moveUpdate(_local1.turn, _local1.v);
_local1.SimpleForm(q.fantilt, q.spinRate);
_local1.Draw();
return;
case 3 :
if (q.fac < 1) {
q.fac = q.fac + 0.05;
}
q.localGrav = q.fac * grav;
q.vz = q.vz - q.localGrav;
_local1.z = _local1.z + q.vz;
if ((_local1.z + (q.vz - q.localGrav)) < _local1.restAlt()) {
q.state = 4;
}
q.fantilt = (now.fantilt * (1 - q.fac)) + (q.droptilt * q.fac);
q.bob = now.bob * (_local1.z / q.oz);
q.spinRate = now.spinRate * (_local1.z / q.oz);
_local1.SimpleForm(q.fantilt, q.spinRate * (1 - q.fac));
_local1.Draw();
}
};
_global.Sack = function () {
};
Sack.prototype = new Being();
Sack.prototype.basicInitialize = function () {
q.legs.x = -q.bodylength;
q.cvpt.x = -q.bodylength;
q.cvpt.z = q.cvz;
};
Sack.prototype.arrange = function () {
q.belly = new Oval(this, q.r, q.YS, 0, 1);
q.cvpt = new Point(q.belly);
q.legs = new Point(q.belly);
q.torso = new Bridge(this, q.belly, q.legs, q.torsoLW, 0, 1, q.cvpt);
};
Sack.prototype.formFlux = function (osc) {
var _local1 = cos(osc / 2) * q.fluxfactor;
q.belly.YS = q.YS - (((q.YS - 1) * 5) * _local1);
q.belly.r = q.r + (q.oHR * _local1);
q.bellyz = q.belly.r * ((cos(q.tilt) * cos(q.tilt)) + ((q.belly.YS * sin(q.tilt)) * sin(q.tilt)));
q.belly.z = q.bellyz;
};
Sack.prototype.stateMatch = function (src) {
var _local1 = src;
q.osc = _local1.osc;
q.addosc = _local1.addosc;
q.launch = _local1.launch;
q.vzi = _local1.vzi;
q.vz = _local1.vz;
q.tiltStack = _local1.tiltStack;
q.legsTilt = _local1.legsTilt;
q.tilt = _local1.tilt;
q.tilti = _local1.tilti;
q.belly.z = _local1.belly.z;
};
Sack.prototype.draw = (Sack.prototype.sackDraw = function () {
var _local1 = this;
_local1.locate();
if (q.belly.pz == undefined) {
q.belly.locate();
}
q.legs.locateRoteTilt(_local1.face, q.legstilt + q.legsBaseTilt);
q.belly.locate();
q.belly.angleSet(_local1.face, q.tilt);
q.cvpt.locateRoteTilt(_local1.face, q.tilt);
q.belly.draw(_local1.face, q.tilt);
q.torso.bridgeCurvedOval();
});
Sack.prototype.move = function (brakefactor) {
var _local1 = this;
var _local2 = brakefactor;
switch (q.launch) {
case 0 :
var extraOsc = ((-0.1 * sin(q.osc)) * (1 - _local2));
q.addOsc = (q.addOscBase * _local2) + extraOsc;
q.osc = q.osc + q.addOsc;
_local1.z = 0;
if (q.osc > PI) {
_local1.moveUpdate(_local1.turn, q.vh);
q.launch = 1;
_local1.formFlux(PI);
q.vzi = q.vSpring * _local2;
if (q.tilt > PI) {
q.tilt = q.tilt - (PI * 2);
}
q.tilti = ((-PI) / 2) + (((q.tilt + (PI / 2)) + (q.tilti + (PI / 2))) / 2);
q.vz = q.vzi - ((grav * (q.osc - PI)) / q.addOsc);
_local1.z = _local1.z + ((q.vz * (q.osc - PI)) / q.addOsc);
q.tilt = ((-PI) / 2) + (((q.tilti + (PI / 2)) * q.vz) / q.vzi);
} else {
_local1.vmoveData(cursor);
q.tilt = ((((((-q.osc) / PI) * q.tiltMax) * _local1.v) / _local1.vmax) * _local2) - (PI / 2);
q.vh = _local1.v * _local2;
_local1.formFlux(q.osc);
_local1.moveUpdate(_local1.turn, q.vh);
}
break;
case 1 :
q.vz = q.vz - grav;
_local1.z = _local1.z + q.vz;
q.tilt = ((-PI) / 2) + ((q.tilti + (PI / 2)) * sin(((PI / 2) * q.vz) / q.vzi));
_local1.moveUpdate(0, _local1.v);
if (_local1.z >= 0) {
break;
}
q.launch = 0;
q.tilt = q.tilti;
var _local3 = _local1.z / q.vz;
q.osc = (-PI) + (_local3 * q.addOsc);
_local1.formFlux(q.osc);
_local1.z = 0;
q.dtilt = ((-_local3) * _local1.v) / q.belly.z;
q.tilt = (((-PI) / 2) - (q.tilti + (PI / 2))) + q.dtilt;
}
q.tiltStack.splice(0, 0, q.tilt);
q.tiltStack.splice(4, 1);
q.legstilt = ((((q.tiltstack[1] * (1 - q.stiff)) + (q.tilt * q.stiff)) + (PI / 2)) / 2) - (PI / 2);
};
PodSackProperties = function () {
var _local1 = this;
_local1.__proto__ = BeanBagProps;
_local1.scl = 0.15;
_local1.lw = 5 * _local1.scl;
_local1.torsoLW = 5 * _local1.scl;
_local1.r = 22 * _local1.scl;
_local1.YS = 1.1;
_local1.bodyLength = 50 * _local1.scl;
_local1.oHR = _local1.r / 7;
_local1.z = 0;
_local1.addOscBase = 0.9;
_local1.vSpring = 1.5;
_local1.fluxfactor = 1;
_local1.tiltMax = PI / 6;
_local1.tilti = (-PI) / 2;
_local1.cvz = 6.7 * _local1.scl;
_local1.eyeR = 2 * _local1.scl;
_local1.stiff = 0;
_local1.antennaL = 18 * _local1.scl;
_local1.bend = PI / 12;
};
_global.PodSack = function () {
};
PodSack.prototype = new Sack();
PodSack.prototype.Initialize = function () {
var _local1 = this;
_local1.Arrange();
_local1.basicInitialize();
_local1.motionSet(0.2, 4, 0.015, 75, q.scl);
q.belly.z = q.belly.r * ((cos(q.tilt) * cos(q.tilt)) + ((q.belly.YS * sin(q.tilt)) * sin(q.tilt)));
q.tilti = (-PI) / 2;
q.tiltStack = new Array((-PI) / 2, (-PI) / 2, (-PI) / 2, (-PI) / 2);
q.beacon = new antenna(_local1, q.antennaL, q.lw, q.feetR, q.legs);
q.pulse = new Loop(_local1.parent, "loop", q.r, 0, 0);
q.pulse.attachTo(q.beacon.atip);
q.pulse.setColor(9);
};
PodSack.prototype.Run = function (target) {
var _local1 = this;
_local1.move(_local1.v / _local1.vmax);
_local1.Draw();
_local1.setDepth();
};
PodSack.prototype.Draw = function () {
this.sackDraw();
q.belly.setDepth();
q.beacon.draw(this.face, q.tilt + (PI / 2), q.bend);
if (abs(q.osc) < (q.addosc / 2)) {
q.pulsePhase = 0;
}
if (q.pulsephase < 1) {
q.pulsephase = q.pulsephase + 0.1;
q.pulse.locate();
var _local1 = sin((q.pulsephase * PI) / 2);
q.pulse.r = (q.beacon.atip.r * (1 - _local1)) + ((q.beacon.atip.r * 10) * _local1);
q.pulse.form._alpha = (100 * (1 - _local1)) * (1 - _local1);
}
q.pulse.draw(PI / 2, 0);
};
PodSackArc = function () {
now = PodSackProps;
q.__proto__ = now;
below = BeanBagProps;
q.links = new Array(new Link("beanBagArc", "b", 15), new Link("birdSackArc", "s", 15));
this.standardRoutes();
q.routes = new Array();
q.routes[0] = new Array("p", "e");
q.routes[1] = new Array("b");
q.routes[2] = new Array("s");
};
PodSackArc.prototype = new PodSack();
PodSackArc.prototype.Enter = function (letter) {
var _local1 = this;
switch (letter) {
case "s" :
_local1.stateMatch(was);
break;
case "b" :
_local1.stateMatch(was);
}
_local1.icolorShade(3);
q.waitcount = 200;
};
PodSackArc.prototype.Exit = function (letter) {
};
PodSackArc.prototype.segue = function (inc, letter) {
var _local3 = inc;
var _local2 = _local3;
q.segfactor = _local2;
var binc = cos((PI / 2) - (_local3 * (PI / 2)));
var _local1 = scurve(_local3);
q.bend = now.bend * _local1;
if (!(letter === "s")) {
} else {
q.eyes.setEyeRadius(now.eyeR * _local1);
}
};
BeanBagProperties = function () {
var _local1 = this;
_local1.__proto__ = WindMillProps;
_local1.scl = 0.15;
_local1.lw = 5 * _local1.scl;
_local1.torsoLW = 5 * _local1.scl;
_local1.r = 22 * _local1.scl;
_local1.feetr = 4 * _local1.scl;
_local1.YS = 1.1;
_local1.knobR = 6 * _local1.scl;
_local1.bodyLength = 50 * _local1.scl;
_local1.oHR = _local1.r / 7;
_local1.z = 0;
_local1.addOscBase = 0.9;
_local1.vSpring = 1.5;
_local1.fluxfactor = 1;
_local1.tiltMax = PI / 6;
_local1.footOpen = PI / 6;
_local1.pedalR = 18 * _local1.scl;
_local1.tilti = (-PI) / 2;
_local1.cvz = 6.7 * _local1.scl;
_local1.colrY = cos(_local1.footOpen) * _local1.pedalR;
};
_global.BeanBag = function () {
};
BeanBag.prototype = new Sack();
BeanBag.prototype.Initialize = function () {
var _local1 = this;
_local1.Arrange();
_local1.basicInitialize();
_local1.motionSet(0.2, 4, 0.015, 75, q.scl);
q.spokes = new Array(new Part(_local1, 0, 0), new Part(_local1, 0, 0), new Part(_local1, 0, 0));
q.feet = new Array(new Circle(_local1, q.feetr, 0, 1), new Circle(_local1, q.feetr, 0, 1), new Circle(_local1, q.feetr, 0, 1));
n = 0;
while (n <= 2) {
q.spokes[n].iColorBlend(0, 1);
q.feet[n].iColorBlend(0, 1);
q.feet[n].attachTo(q.legs);
n++;
}
q.belly.z = q.belly.r * ((cos(q.tilt) * cos(q.tilt)) + ((q.belly.YS * sin(q.tilt)) * sin(q.tilt)));
q.tilti = (-PI) / 2;
q.tiltStack = new Array((-PI) / 2, (-PI) / 2, (-PI) / 2, (-PI) / 2);
};
BeanBag.prototype.Run = function (target) {
this.move(1);
this.Draw();
};
BeanBag.prototype.Draw = function () {
this.sackDraw();
n = 0;
while (n <= 2) {
var _local1 = q.feet[n];
_local1.angle = (q.spin + (((n * 2) / 3) * PI)) + (cos(q.twist) / 10);
_local1.x = (q.pedalR * cos(_local1.angle)) * cos(q.footOpen);
_local1.y = (q.pedalR * sin(_local1.angle)) * cos(q.footOpen);
_local1.z = q.pedalR * sin(q.footOpen);
_local1.locateRoteTilt(this.face, q.legstilt + (PI / 2));
_local1.draw();
var _local2 = q.spokes[n].form;
_local2.clear();
_local2.lineStyle((q.lw * 10) * q.legs.depth, 0);
_local2.moveTo(q.legs.vx, q.legs.vy);
_local2.lineTo(_local1.vx, _local1.vy);
var _local3 = ((_local1.py - q.legs.py) / q.colrY) / 4;
q.spokes[n].ColorBlend(_local3);
_local1.ColorBlend(_local3);
_local1.setDepth();
q.spokes[n].fore(q.feet[n]);
n++;
}
};
BeanBagArc = function () {
now = BeanBagProps;
q.__proto__ = now;
below = WindMillProps;
q.links = new Array(new Link("windMillArc", "w", 5), new Link("podSackArc", "q", 15));
this.standardRoutes();
};
BeanBagArc.prototype = new BeanBag();
BeanBagArc.prototype.Enter = function (letter) {
switch (letter) {
case "w" :
q.tilt = (-PI) / 2;
q.vz = 0;
q.osc = (-PI) / 3;
q.launch = 0;
q.waitCount = 300;
this.icolorShade(3);
return;
case "q" :
this.stateMatch(was);
}
};
BeanBagArc.prototype.Exit = function (letter) {
};
BeanBagArc.prototype.segue = function (inc, letter) {
var factor = inc;
q.segfactor = factor;
var binc = cos((PI / 2) - (inc * (PI / 2)));
var sinc = scurve(inc);
switch (letter) {
case "w" :
q.fluxfactor = factor;
q.YS = (1 - binc) + (now.YS * binc);
q.bodylength = (now.bodylength * binc) + (was.bodyLength * (1 - binc));
q.r = (q.belly.r = (now.r * binc) + (was.r * (1 - binc)));
q.pedalr = (now.pedalr * sinc) + (was.pedalr * (1 - sinc));
q.footOpen = (now.footOpen * sinc) + (was.fantilt * (1 - sinc));
q.ohr = now.ohr * binc;
n = 1;
while (n <= 3) {
var path = eval ("q.foot" + n);
path.r = (was.feetr * (1 - factor)) + (q.feetr * factor);
n++;
}
this.basicInitialize();
return;
case "q" :
q.footOpen = (now.footOpen * sinc) + ((PI / 2) * (1 - sinc));
}
};
BeanBagArc.prototype.switchCondition = function (letter) {
switch (letter) {
case "w" :
if (((q.launch == 1) and (q.vz < grav)) and (q.vz > 0)) {
return(1);
}
return;
default :
return(1);
}
};
BirdSackProperties = function () {
var _local1 = this;
_local1.__proto__ = BeanBagProps;
_local1.eyeR = 0.25;
_local1.headX = 28 * _local1.scl;
_local1.neckX = -18 * _local1.scl;
_local1.headR = _local1.r / 2;
_local1.headLngth = _local1.r * 1.5;
};
_global.BirdSack = function () {
};
BirdSack.prototype = new Sack();
BirdSack.prototype.Initialize = function () {
var _local1 = this;
_local1.Arrange();
_local1.motionSet(0.2, 4, 0.015, 120, q.scl);
q.spokes = new Part(_local1, 0, 0);
q.head = new BirdHead(_local1, q.legs, q.headR, q.headLngth, q.eyeR, "loop", 0, q.headx, q.neckx, q.lw, 0);
q.belly.z = q.belly.r * ((cos(q.tilt) * cos(q.tilt)) + ((q.belly.YS * sin(q.tilt)) * sin(q.tilt)));
q.tilti = ((-PI) / 2) - 1;
q.cvpt.z = 1;
_local1.basicInitialize();
};
BirdSack.prototype.Run = (BirdSack.prototype.BasicRun = function (target) {
var _local1 = this;
_local1.move(_local1.v / _local1.vmax);
_local1.Draw();
});
BirdSack.prototype.Draw = function () {
this.sackDraw();
q.head.mouseTrack(cursor);
var _local3 = q.legs.px - ((q.cvpt.px + q.belly.px) / 2);
var _local2 = q.legs.py - ((q.cvpt.py + q.belly.py) / 2);
var _local1 = q.legs.pz - ((q.cvpt.pz + q.belly.pz) / 2);
q.neckTilt = atan2(-_local1, Pyt(_local3, _local2));
q.head.Draw(q.head.pheadRote, q.head.pheadTilt, this.face, q.neckTilt, 1, 4, q.flex);
q.head.setDepth();
};
BirdSackArc = function () {
now = BirdSackProps;
q.__proto__ = now;
below = BeanBagProps;
q.links = new Array(new Link("boxArc", "x", 100), new Link("podSackArc", "q", 25));
};
BirdSackArc.prototype = new BirdSack();
BirdSackArc.prototype.Enter = function (letter) {
if (!(letter === "q")) {
} else {
q.head.head.px = was.beacon.atip.px;
q.head.head.px = was.beacon.atip.py;
q.head.head.px = was.beacon.atip.pz;
q.head.neckPt.px = was.legs.px + ((was.legs.px - was.beacon.atip.px) * (q.head.nx / q.head.hx));
q.head.neckPt.py = was.legs.py + ((was.legs.py - was.beacon.atip.py) * (q.head.nx / q.head.hx));
q.head.neckPt.pz = was.legs.pz + ((was.legs.pz - was.beacon.atip.pz) * (q.head.nx / q.head.hx));
this.stateMatch(was);
q.state = 0;
q.waitCount = 600;
}
q.boxFace = boxprops.iangle;
};
BirdSackArc.prototype.Exit = function (letter) {
};
BirdSackArc.prototype.segue = function (inc, letter) {
var _local2 = inc;
switch (letter) {
case "x" :
if (_local2 >= 0.6) {
this.melt((_local2 - 0.6) * 2.5);
} else {
q.swellOsc = _local2 * 1.667;
if (q.crossswitch != 1) {
this.CrossForm();
}
q.belly.draw(1 - ((scurve(((1 - q.swellOsc) / 2) + 0.5) - 0.5) * 2));
}
return;
case "q" :
var _local1 = scurve(_local2);
q.head.setHeadRadius((was.feetr * (1 - _local1)) + (q.headr * _local1));
q.head.setEyeRadius(q.eyeR * _local1);
q.head.setNeckScale(((was.pedalR / (q.head.hx - q.head.nx)) * (1 - _local1)) + _local1);
q.head.flex = _local1;
q.head.setLength(q.headLngth * _local1);
}
};
BirdSackArc.prototype.switchCondition = function (letter) {
var _local1 = this;
switch (letter) {
case "x" :
if ((_local1.z == 0) and (abs(_local1.vx) < ((stage.width / 2) * scale))) {
_local1.MeltForm();
q.state = 1;
return(1);
}
return(undefined);
default :
return(1);
}
return(undefined);
};
BirdSackArc.prototype.Run = function () {
switch (q.state) {
case 0 :
this.basicRun();
return;
case 1 :
}
};
BirdSack.prototype.meltForm = function () {
q.tilt = (-PI) / 2;
q.belly.iColorBlend(0, 9);
q.torso.iColorBlend(0, 9);
q.belly.ptype(ovalDisc);
q.belly.draw = q.belly.ovalDiscDraw;
q.bys = q.belly.YS;
q.br = q.belly.r;
q.falseShadow = new Disc(this, q.head.head.r, 3);
q.falseShadow.form._alpha = 0;
q.falseShadow.locate();
q.falseShadow.draw(0, PI / 2);
q.meltSwitch = 1;
};
BirdSack.prototype.melt = function (inc) {
var _local2 = inc;
var _local1 = scurve(_local2);
var sinc1 = ((scurve((_local2 / 2) + 0.5) - 0.5) * 2);
var sinc2 = (scurve(_local2 / 2) * 2);
var _local3 = _local1 * _local1;
q.head.flex = _local1;
q.head.neck.lw = now.lw * _local1;
if (_local2 < 0.2) {
q.head.neck.form._alpha = 100 * (_local2 / 0.2);
}
q.belly.r = ((boxProps.boxunit * 1.5) * (1 - sinc1)) + (q.br * sinc1);
q.belly.YS = (q.bys * sinc2) * sinc2;
q.legs.x = (-q.bodylength) * _local1;
q.cvpt.x = ((-q.bodylength) * _local3) + (q.legs.x * (1 - _local3));
q.cvpt.z = 1 * _local3;
q.belly.ColorBlend(1 - _local1);
q.torso.ColorBlend(1 - _local1);
q.belly.z = q.belly.altitude(q.tilt);
q.lw = now.lw * _local2;
q.head.neck.lw = (was.lw * (1 - _local1)) + (now.lw * _local2);
q.head.neckpt.x = q.neckX * _local1;
q.head.head.x = (q.headX * _local1) + (q.head.head.r * (1 - _local1));
q.segheadTilt = (q.head.headTilt * _local1) + ((PI / 2) * (1 - _local1));
if (_local2 < 0.5) {
q.falseShadow.form._alpha = 50 * (1 - (_local2 * 2));
}
this.sackDraw();
q.head.Draw(q.head.headRote, q.segheadTilt, this.face, q.neckTilt, 1);
q.falseShadow.aft(q.head.head);
q.head.setDepth();
};
BirdSack.prototype.crossForm = function () {
q.spokes.disappear();
q.belly.disappear();
q.belly = new discToCross(this, boxProps.boxunit * 1.5, q.belly.sq, q.boxFace, 9);
q.belly.locate();
q.crossswitch = 1;
};
BoxProperties = function () {
var _local1 = this;
_local1.__proto__ = eggProps;
_local1.scl = 1;
_local1.boxUnit = 5.6 * _local1.scl;
_local1.boxUnit2 = 6 * _local1.scl;
_local1.iangle = PI / 4.2;
_local1.iz = 0.25;
_local1.topColr = 10;
_local1.bottomColr = 11;
};
_global.Box = function () {
};
Box.ptype(Being);
Box.prototype.Initialize = function () {
var _local1 = this;
_local1.motionSet(0.02, 0.6, 0.006, q.unit, q.scl);
q.boxtilt = 0;
q.halt = 1;
q.slow = 0;
_local1.v = 0;
q.shell = new basicCube(_local1, q.boxunit, q.topColr, q.bottomColr, 1);
q.shell.z = q.shell.unit;
};
Box.prototype.basicRun = (Box.prototype.run = function () {
var _local1 = this;
if (q.halt == 0) {
if (_local1.v < _local1.vmax) {
_local1.v = _local1.v + _local1.a;
} else {
_local1.v = _local1.vmax;
}
var _local2 = _local1.v / ((q.shell.unit * abs(cos(q.boxtilt))) + (q.shell.unit * abs(sin(q.boxtilt))));
q.boxtilt = q.boxtilt + _local2;
q.shell.z = (q.shell.unit * abs(cos(q.boxtilt))) + (q.shell.unit * abs(sin(q.boxtilt)));
if (q.boxtilt > (PI / 2)) {
q.boxtilt = q.boxtilt - (PI / 2);
var _local3 = 1 - (q.boxtilt / _local2);
var frac2 = (q.boxtilt / _local2);
_local1.step(_local3);
_local1.changeDir();
if (q.halt == 0) {
_local1.step(frac2);
}
} else {
_local1.step(1);
}
} else if (q.slow != 1) {
if (_local1.distanceCheck()) {
q.halt = 0;
}
} else {
q.slow = 0;
}
_local1.locate();
q.shell.locate();
q.shell.draw(_local1.face, -q.boxtilt);
});
Box.prototype.distanceCheck = function () {
var _local1 = this;
var _local3 = cursor.px - _local1.px;
var _local2 = cursor.py - _local1.py;
var dx2 = ((_local3 * cos(-_local1.face)) + (_local2 * sin(-_local1.face)));
var dy2 = ((_local2 * cos(-_local1.face)) - (_local3 * sin(-_local1.face)));
if ((abs(dx2) > q.shell.unit) or (abs(dy2) > q.shell.unit)) {
return(1);
}
return(0);
};
Box.prototype.step = function (inc) {
var _local1 = this;
_local1.x = _local1.x + ((_local1.v * cos(_local1.face)) * inc);
_local1.y = _local1.y + ((_local1.v * sin(_local1.face)) * inc);
};
Box.prototype.changeDir = function () {
var _local1 = this;
if (_local1.distanceCheck() and (q.slow == 0)) {
_local1.boxturn();
} else {
_local1.v = 0;
q.halt = 1;
q.boxtilt = 0;
q.shell.z = q.shell.unit;
}
};
Box.prototype.boxturn = function () {
var _local1 = this;
var _local2 = compress(atan2(cursor.py - _local1.py, cursor.px - _local1.px) - _local1.face);
if ((_local2 > (PI / 4)) and (_local2 < PI)) {
_local1.face = compress(_local1.face + (PI / 2));
} else if ((_local2 < ((-PI) / 4)) and (_local2 > (-PI))) {
_local1.face = compress(_local1.face - (PI / 2));
}
};
BoxArc = function () {
now = BoxProps;
q.__proto__ = now;
below = eggProps;
q.links = new Array(new Link("birdSackArc", "s", 20), new Link("eggArc", "e", 27), new Link("flowBoxArc", "f"), new Link("boxWalkerArc", "m"), new Link("boxWagonArc", "d"));
};
BoxArc.prototype = new Box();
BoxArc.prototype.Enter = function (letter) {
var _local1 = this;
switch (letter) {
case "m" :
q.segfactor = 1;
q.shell.z = q.shell.unit;
q.state = 1;
q.waitcount = 2;
_local1.z = q.iz;
break;
case "s" :
_local1.face = was.boxface;
q.headrote = was.head.headRote;
_local1.birdShell();
q.slow = 1;
q.halt = 1;
q.state = 0;
q.waitcount = 1;
break;
case "f" :
q.halt = 1;
q.slow = 1;
q.halt = 1;
q.state = 1;
q.waitcount = 1;
_local1.z = q.iz;
break;
case "e" :
q.tilt = was.tilt;
_local1.eggShell();
q.oface = _local1.face;
_local1.face = q.iangle;
q.state = 0;
q.waitcount = 300;
break;
default :
q.state = 1;
q.waitcount = 200;
_local1.z = 0;
}
_local1.icolorShade(3);
};
BoxArc.prototype.segue = function (inc, letter) {
var _local1 = this;
var _local3 = inc;
var _local2 = (q.segfactor = scurve(_local3));
switch (letter) {
case "e" :
_local1.z = q.iz * _local2;
_local1.locate();
_local1.eggDraw();
q.preshell.locate();
q.preshell.draw(_local1.face, q.segFactor);
q.head.fore(q.preshell.sides[4]);
if ((_local3 == 1) and (q.segueSwitch == -1)) {
q.head.disappear();
q.eyes.disappear();
q.preshell.disappear();
q.falseShadow.disappear();
q.state = 1;
}
return;
case "s" :
_local1.z = q.iz * _local2;
_local1.locate();
q.preshell.locate();
q.preshell.draw(_local1.face, q.segFactor);
_local1.birdDraw();
q.head.fore(q.preshell.sides[4]);
if (!((_local3 == 1) and (q.segueSwitch == -1))) {
break;
}
q.head.disappear();
q.eyes.disappear();
q.preshell.disappear();
q.falseShadow.disappear();
q.state = 1;
}
};
BoxArc.prototype.run = function () {
var _local1 = this;
switch (q.state) {
case 0 :
return;
case 1 :
_local1.basicRun();
return;
case 2 :
q.nose.draw(_local1.face, (PI / 2) + 0.001);
q.eyes[0].draw(_local1.face + (PI / 2));
q.eyes[1].draw(_local1.face + (PI / 2));
if (q.eyes[0].sidecheck() == 1) {
q.eyes[0].aft(_local1, 3);
} else {
q.eyes[0].fore(_local1, 3);
}
if (q.eyes[1].sidecheck() == 1) {
q.eyes[1].fore(_local1, 1);
} else {
q.eyes[1].aft(_local1, 1);
}
q.nose.fore(_local1, 2);
_local1.setDepth();
return;
case 3 :
_local1.basicRun();
if (q.boxTilt == 0) {
q.boxTilt = PI / 2;
}
q.nose.locateRoteTilt(_local1.face, (PI / 2) - q.boxtilt);
q.eyes[0].locateRote(_local1.face);
q.eyes[1].locateRote(_local1.face);
q.nose.draw(_local1.face, (PI / 2) - q.boxtilt);
q.eyes[0].draw(_local1.face + (PI / 2));
q.eyes[1].draw(_local1.face + (PI / 2));
if (q.eyes[0].sidecheck() == 1) {
q.eyes[0].aft(_local1, 3);
} else {
q.eyes[0].fore(_local1, 3);
}
if (q.eyes[1].sidecheck() == 1) {
q.eyes[1].fore(_local1, 1);
} else {
q.eyes[1].aft(_local1, 1);
}
if (q.nose.base.sidecheck() == 1) {
q.nose.aft(_local1, 2);
} else {
q.nose.fore(_local1, 2);
}
_local1.setDepth();
}
};
BoxArc.prototype.changeCondition = function (letter) {
return(1);
};
BoxArc.prototype.switchCondition = function (letter) {
var _local1 = this;
switch (letter) {
case "e" :
if (q.halt == 1) {
q.tilt = PI / 2;
q.shell.disappear();
_local1.eggShell();
q.state = 0;
return(1);
}
q.slow = 1;
return(undefined);
case "m" :
if (q.halt == 1) {
return(1);
}
q.slow = 1;
return(undefined);
case "f" :
if ((abs(_local1.vx) < ((stage.width / 4) * scale)) and (_local1.y < 100)) {
if (q.halt == 1) {
return(1);
}
q.slow = 1;
}
return(undefined);
default :
if (q.halt == 1) {
return(1);
}
q.slow = 1;
}
return(undefined);
};
BoxArc.prototype.eggShell = function (letter) {
var _local1 = this;
q.preshell = new foldingCube(_local1, q.boxunit, 3, q.topcolr, q.bottomcolr, q.topcolr, 1);
q.preshell.z = 0;
q.preshell.locate();
q.head = new oval(_local1, eggProps.r, eggProps.ys, 0, 1);
q.head.z = q.head.altitude(q.tilt);
q.falseShadow = new Disc(_local1, q.head.r, 4);
};
BoxArc.prototype.eggDraw = function (letter) {
q.head.locate();
q.head.angleSet(q.oface, q.tilt);
q.head.draw();
q.head.setDepth();
q.falseShadow.locate();
q.falseShadow.draw(0, PI / 2);
q.falseShadow.aft(q.head);
};
BoxArc.prototype.birdShell = function (letter) {
var _local1 = this;
q.head = new tearDrop(_local1, birdSackProps.headr, birdSackProps.headlngth, 0, 1);
q.head.z = q.head.r;
q.eyes = new eyes(_local1, birdSackProps.headr, birdSackProps.eyeR, "loop");
q.eyes.attachTo(q.head);
q.preshell = new foldingCube(_local1, q.boxunit, 9, 10, 11, 10, 1);
q.preshell.z = 0;
q.falseShadow = new Disc(_local1, q.head.r, 3);
q.falseShadow.form._alpha = 50;
q.state = 0;
};
BoxArc.prototype.birdDraw = function (letter) {
q.head.locate();
q.head.draw(q.headRote, PI / 2);
q.head.setDepth();
q.eyes.draw(q.headRote);
q.eyes.setDepth();
q.falseShadow.locate();
q.falseShadow.draw(0, PI / 2);
q.falseShadow.aft(q.head);
};
boxWalkerProperties = function () {
var _local1 = this;
_local1.id = letterCrunch("m");
_local1.__proto__ = boxProps;
_local1.id = "boxWalker";
_local1.scl = 0.11;
_local1.cx = 0.4;
_local1.LW = 12 * _local1.scl;
_local1.LL = 48 * _local1.scl;
_local1.tBmx = PI / 6;
_local1.sF = 0;
_local1.cF = 0.3;
_local1.unit = _local1.LL * 1.95;
_local1.cxo = 20 * _local1.scl;
_local1.yw1 = 25 * _local1.scl;
_local1.yw2 = 25 * _local1.scl;
_local1.ob = 5 * _local1.scl;
_local1.walkiz = _local1.LW / 2;
};
boxWalker = function () {
};
boxWalker.ptype(Being);
boxWalker.prototype.Initialize = function () {
var _local1 = this;
q.head = new basicCube(_local1, q.boxunit, 10, 11, 1);
q.head.attachTo(_local1);
q.center = new Point(_local1);
q.center2 = new Point(_local1);
q.legs = new Part(q.head);
q.legs1 = new Array(new Limb(q.legs, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, 0), new Limb(q.legs, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, 0));
q.legs2 = new Array(new Limb(q.legs, 0, 0, new Point(q.center2), new Point(q.center2), new Point(q.center2), 0, 0), new Limb(q.legs, 0, 0, new Point(q.center2), new Point(q.center2), new Point(q.center2), 0, 0));
q.legs1[0].attachTo(_local1);
q.legs1[1].attachTo(_local1);
q.legs2[0].attachTo(_local1);
q.legs2[1].attachTo(_local1);
_local1.legSet(q.legs1[0]);
_local1.legSet(q.legs1[1]);
_local1.legSet(q.legs2[0]);
_local1.legSet(q.legs2[1]);
q.legs1[0].iColorBlend(0, 1);
q.legs1[1].iColorBlend(0, 1);
q.legs2[0].iColorBlend(0, 1);
q.legs2[1].iColorBlend(0, 1);
_local1.motionSet(0.075, 3, 0.0055, 150, q.scl);
_local1.vmin = 0.1;
q.loke1 = new Loke(_local1, "walk", q.legs1);
q.loke2 = new Loke(_local1, "walk", q.legs2);
q.loke1.osc = PI / 4;
q.loke2.osc = (-PI) / 4;
q.center.x = q.cxo;
q.center2.x = -q.cxo;
q.loke2.attachTo(q.center2);
q.loke2.aleg = q.loke2.legs[1];
q.loke2.ileg = q.loke2.legs[0];
q.legs1[0].base.y = -q.yw1;
q.legs1[1].base.y = q.yw1;
q.legs2[0].base.y = -q.yw1;
q.legs2[1].base.y = q.yw1;
_local1.v = 0;
q.eye = new drawEye(_local1, (q.boxunit * 2) / 3, (q.boxunit * 1) / 2, (q.boxunit * 1) / 5, (q.boxunit * 1) / 5, 9);
q.eye.attachTo(q.head);
q.eye.x = q.boxunit;
q.head.sides[1].form.swapDepths(11);
q.legs.form.swapDepths(12);
q.head.sides[0].form.swapDepths(13);
q.head.sides[2].form.swapDepths(14);
q.head.sides[3].form.swapDepths(15);
q.head.sides[4].form.swapDepths(16);
q.head.sides[5].form.swapDepths(17);
};
boxWalker.prototype.run = (boxWalker.prototype.basicRun = function () {
var _local1 = this;
_local1.z = q.walkiz + q.iz;
_local1.vMove(cursor);
if (q.segfactor < 1) {
_local1.turn = _local1.turn / 2;
}
q.loke1.process(_local1.v, _local1.vmax);
q.loke2.process(_local1.v, _local1.vmax);
var _local2 = atan2(q.center.z - q.center2.z, q.center.x * 2);
q.headAngle = ((PI / 20) + (_local2 / 8)) * q.segfactor;
_local1.draw();
q.eye.locateRoteTilt(_local1.face, q.headAngle);
q.eye.draw(_local1.face, q.headAngle);
q.eye.fore(_local1, 6);
});
boxWalker.prototype.draw = function () {
var _local1 = this;
_local1.locate();
q.center.locateRote(_local1.face);
q.center2.locateRote(_local1.face);
q.head.locate();
q.head.draw(_local1.face, q.headAngle);
_local1.boxLegDraw(q.legs1[0], q.loke1.face);
_local1.boxLegDraw(q.legs1[1], q.loke1.face);
_local1.boxLegDraw(q.legs2[0], q.loke2.face);
_local1.boxLegDraw(q.legs2[1], q.loke2.face);
};
boxWalker.prototype.boxLegDraw = function (path, face) {
var _local1 = path;
var _local2 = face;
_local1.base.locateRote(_local2);
_local1.end.locateRote(_local2);
_local1.drawCurved(_local2);
_local1.setDepth(_local1.base);
_local1.ColorBlend(((((_local1.base.y / q.yw1) * cos(this.face)) + ((_local1.base.parent.x / q.cxo) * sin(this.face))) + 2) / 4);
};
BoxWalkerArc = function () {
now = boxWalkerProps;
q.__proto__ = now;
below = boxProps;
q.links = new Array(new Link("BoxArc", "x", 24));
};
BoxWalkerArc.prototype = new BoxWalker();
BoxWalkerArc.prototype.Enter = function (letter) {
var _local1 = this;
_local1.v = 0.01;
_local1.ivmax = _local1.vmax;
q.itr = _local1.tr;
if (sin(_local1.face) > 0) {
_local1.face = _local1.face + PI;
}
q.waitcount = 600;
_local1.icolorshade(3);
};
BoxWalkerArc.prototype.segue = function (inc, letter) {
var _local2 = this;
var _local3 = inc;
var _local1 = (q.segfactor = scurve(_local3));
q.eye.open(_local1);
_local2.vmax = (_local2.v = (_local2.ivmax * _local1) + 0.001);
if (_local3 > 0.5) {
_local2.tr = (q.itr * 2) * (_local3 - 0.5);
}
q.loke1.unit = (q.loke2.unit = (q.loke1.legs[0].unit = (q.loke1.legs[1].unit = (q.loke2.legs[0].unit = (q.loke2.legs[1].unit = ((3 * q.unit) / 4) + ((q.unit / 4) * _local1))))));
q.leg1.lngth = (q.leg2.lngth = (q.leg3.lngth = (q.leg4.lngth = (q.LL / 4) + (((3 * q.LL) / 3) * _local1))));
q.head.z = ((((((q.center.z + q.center2.z) / 2) - (q.head.unit / 1.5)) - q.iz) * _local1) - q.walkiz) + q.head.unit;
if ((_local3 < 0.1) and (q.segueswitch == 1)) {
q.legs.disappear();
}
};
BoxWagonProperties = function () {
var _local1 = this;
_local1.__proto__ = boxProps;
_local1.id = "BoxWagon";
_local1.scl = 0.11;
_local1.stackL = (_local1.boxunit * 2) / 3;
_local1.hzo = _local1.boxunit * 1.75;
_local1.bob = 3 * _local1.scl;
_local1.eyeR = _local1.boxunit / 4;
_local1.tiltMax = 2;
_local1.stackR = _local1.boxunit / 3;
};
BoxWagon = function () {
};
BoxWagon.ptype(Being);
BoxWagon.prototype.Initialize = function () {
q.center = new Point(this);
q.wheel = new Loop(this, "loop2", q.boxunit / 1.2, 2.5 * ((q.boxunit / 1.2) / 10), 0, 0);
q.wheel.setColor(11);
q.loop.attachTo(q.center);
q.spokes = new Array(new Part(this, 0, 11), new Part(this, 0, 11), new Part(this, 0, 11));
q.spokes[0].pts = new Array(new Point(q.wheel), new Point(q.wheel));
q.spokes[1].pts = new Array(new Point(q.wheel), new Point(q.wheel));
q.spokes[2].pts = new Array(new Point(q.wheel), new Point(q.wheel));
q.head = new basicCube(this, q.boxunit, 10, 11, 1);
q.head.attachTo(q.center);
this.motionSet(0.1, 9, 0.0055, 150, q.scl);
q.eye = new Loop(this.parent, "eye", q.eyeR, 0, 0);
q.eye.attachTo(q.head);
q.eye.x = q.boxunit + 0.5;
q.stack = new tube(this.parent, q.stackR, q.stackL, 9, 11);
q.stack.attachTo(q.head);
q.stack.z = q.boxunit * 1.3333;
q.stackMask = new disc(this.parent, q.stackR, 6);
q.MaskPuff = new Circle(this.parent, (q.stackR * 2) / 3, 0);
q.MaskPuff.form.setMask(q.stackMask.form);
q.puffFilm = new Part(this.parent);
q.puffs = new Array();
n = 0;
while (n < 12) {
q.puffs[n] = new Circle(q.puffFilm, (q.stackR * 2) / 3, 1);
q.puffs[n].form.removeMovieClip();
q.puffFilm.form.attachMovie("puffCircle", "form" + n, n);
q.puffs[n].form = eval ("q.puffFilm.form.form" + n);
q.puffs[n].attachTo(this.parent);
q.puffs[n].form._y = -1000;
n++;
}
};
BoxWagon.prototype.run = (BoxWagon.prototype.basicRun = function () {
var _local1 = this;
_local1.z = q.wheel.lnwt / 2;
_local1.vMove(cursor);
q.tip = (((-_local1.turn) * q.tiltMax) + q.tip) / 2;
q.spinRate = (-_local1.v) / (q.wheel.r + (q.wheel.lnwt / 2));
q.wheelSpin = compress(q.wheelSpin + q.spinRate);
q.head.z = q.hzo + (q.bob * cos(q.wheelSpin * 2));
q.wheel.z = q.wheel.r;
_local1.draw();
if ((q.alt >= 1) and (_local1.v > 0.01)) {
q.alt = 0;
q.puffcounter = q.puffcounter + 1;
q.puffnum = q.puffnum + 1;
if (q.puffnum == 12) {
q.puffnum = 0;
}
q.apuff = q.puffs[q.puffnum];
q.apuff.xyz(q.stack.base1.px - filmspace.px, q.stack.base1.py - filmspace.py, (q.stack.base1.pz - filmspace.pz) - (q.apuff.r / 2));
q.apuff.locate();
q.apuff.draw();
q.apuff.form._xscale = q.apuff.form._xscale * ((random(50) / 100) + 0.75);
q.apuff.form._yscale = q.apuff.form._xscale;
q.apuff.rise = 8;
q.apuff.age = 0;
q.apuff.form.swapDepths(q.puffcounter);
} else {
q.alt = q.alt + ((_local1.v / _local1.vmax) * 1.5);
}
n = 0;
while (n < 12) {
q.puffs[n].age = q.puffs[n].age + 0.0416666666666667;
q.puffs[n].form._y = q.puffs[n].form._y - ((q.puffs[n].rise * (1 - sqrt(q.puffs[n].age))) * q.puffs[n].depth);
q.puffs[n].form.gotoAndStop(Math.round(q.puffs[n].age * 100));
n++;
}
q.puffFilm.aft(_local1, 3);
q.stackMask.positionMatch(q.stack.base1);
q.stackMask.fore(_local1, 10);
q.maskPuff.positionMatch(q.apuff);
q.maskPuff.fore(_local1, 11);
});
BoxWagon.prototype.draw = function () {
var _local1 = this;
_local1.locate();
q.center.locate();
q.head.locate();
_local1.setDepth();
q.wheel.locate();
q.nose.locateRote(_local1.face);
q.nose.draw(_local1.face);
q.nose.setDepth();
q.eye.locateRote(_local1.face);
q.eye.draw(_local1.face);
if (q.head.sides[3].sideface == 1) {
q.eye.fore(_local1, 2);
} else {
q.eye.aft(_local1, 2);
}
q.stack.locateRoteTilt(_local1.face + (PI / 2), q.tip);
q.stack.draw(_local1.face + (PI / 2), (PI / 2) + q.tip);
q.stack.fore(_local1);
q.head.draw(_local1.face + (PI / 2), q.tip);
q.head.setDepth();
q.wheel.draw(_local1.face + (PI / 2), q.tip);
n = 0;
while (n < 3) {
var _local3 = cos(q.wheelspin + ((PI / 3) * n));
var _local2 = sin(q.wheelspin + ((PI / 3) * n));
q.spokes[n].pts[0].x = q.wheel.r * _local3;
q.spokes[n].pts[1].x = (-q.wheel.r) * _local3;
q.spokes[n].pts[0].z = q.wheel.r * _local2;
q.spokes[n].pts[1].z = (-q.wheel.r) * _local2;
q.spokes[n].pts[0].locateRote(_local1.face);
q.spokes[n].pts[1].locateRote(_local1.face);
q.spokes[n].form.clear();
q.spokes[n].form.lineStyle((0.5 * q.wheel.depth) * scale, 16777215);
q.spokes[n].form.moveTo(q.spokes[n].pts[0].vx, q.spokes[n].pts[0].vy);
q.spokes[n].form.lineTo(q.spokes[n].pts[1].vx, q.spokes[n].pts[1].vy);
n++;
}
};
BoxWagonArc = function () {
now = BoxWagonProps;
q.__proto__ = now;
below = boxProps;
q.links = new Array(new Link("BoxArc", "x", 40));
};
BoxWagonArc.prototype = new BoxWagon();
BoxWagonArc.prototype.Enter = function (letter) {
var _local1 = this;
q.waitcount = 800;
_local1.z = 0;
_local1.v = 0;
q.iface = _local1.face;
};
BoxWagonArc.prototype.switchCondition = function () {
var _local1 = this;
_local1.slowswitch = 1;
if (_local1.v < 0.003) {
q.iface = _local1.face;
q.iangle = BoxProps.iangle;
while ((q.iangle - q.iface) > (PI / 4)) {
q.iangle = q.iangle - (PI / 2);
}
while ((q.iface - q.iangle) > (PI / 4)) {
q.iangle = q.iangle + (PI / 2);
}
return(1);
}
return(undefined);
};
BoxWagonArc.prototype.segue = function (inc, letter) {
var _local2 = this;
var _local3 = inc;
if (q.segueswitch == -1) {
var iz = boxProps.iz;
}
var _local1 = scurve(_local3);
_local2.slowswitch = 1;
q.hzo = ((now.hzo * _local1) + ((q.boxunit - (q.wheel.lnwt / 2)) * (1 - _local1))) + (iz * (1 - _local1));
q.bob = now.bob * _local1;
q.tiltMax = now.tiltMax * _local1;
q.eye.r = q.eyer * _local1;
q.stack.setLength(q.stackL * _local1);
q.stack.setRadius(q.stackR * sqrt(_local1));
q.stack.z = q.boxunit + ((q.boxunit * 0.3333) * _local1);
if (q.segueSwitch == 1) {
_local2.face = (q.iface * scurve(_local3)) + (q.iangle * (1 - scurve(_local3)));
} else {
_local2.face = q.iface;
}
};
BoxWagonArc.prototype.Exit = function () {
};
FlowBoxProperties = function () {
this.__proto__ = boxProps;
this.scl = 0.11;
};
FlowBox = function () {
};
FlowBox.ptype(Box);
FlowBox.prototype.Initialize = (FlowBox.prototype.BasicInitialize = function (stage) {
var _local1 = this;
var _local2 = stage;
_local1.z = q.iz;
_local1.face = q.iangle - (PI / 2);
q.center = new Point(_local1);
q.center.z = q.boxunit;
q.oboxes = new Array();
m = 0;
while (m < 8) {
q.oboxes[m] = new basicCube(_local1, q.boxunit / 2, 10, 11, 1);
q.oboxes[m].iColorshade(3);
q.oboxes[m].attachTo(q.center);
m++;
}
q.movePaths = new Array();
_local1.Paths(_local2);
_local1.boxLayout(_local2);
_local1.stackBoxes(_local2);
q.boxer = -1;
q.aboxes = new Array(0, 0);
_local1.initLocate();
_local1.boxInit(0);
});
FlowBox.prototype.InitLocate = function () {
var _local1 = this;
_local1.locate();
q.center.locate();
m = 7;
while (m >= 0) {
q.boxes[m].locateRote(_local1.face);
q.boxes[m].draw(_local1.face);
q.boxes[m].stackDepth(_local1.face);
q.boxes[m].Colorshade(q.boxes[m].colorGrade());
m--;
}
};
FlowBox.prototype.run = (FlowBox.prototype.basicRun = function () {
var _local1 = this;
if ((q.aboxes[1] == 0) and (q.aboxes[0] == 0)) {
if (q.slowswitch != 1) {
q.boxer = -1;
q.metaTimer = 0;
_local1.x = _local1.x + ((q.boxunit * cos(_local1.face)) * 4);
_local1.y = _local1.y + ((q.boxunit * sin(_local1.face)) * 4);
_local1.locate();
_local1.boxturn();
q.center.locate();
m = 7;
while (m >= 0) {
q.boxes[m].iface = _local1.face;
q.boxes[m].xyz(q.boxes[m].ix, q.boxes[m].iy, q.boxes[m].iz);
q.boxes[m].locateRote(_local1.face);
q.boxes[m].draw(_local1.face);
q.boxes[m].stackDepth(_local1.face);
m--;
}
_local1.boxInit(0);
} else {
q.halt = 1;
}
}
if (q.halt != 1) {
_local1.moveBox(0);
if (((q.aboxes[0].steps == 1) and (q.aboxes[0].timer == 6)) and (q.aboxes[1] == 0)) {
_local1.boxInit(1);
}
if (q.aboxes[1] != 0) {
_local1.moveBox(1);
}
q.metaTimer = q.metaTimer + 1;
var _local2 = 0;
n = 0;
while (n < 8) {
_local2 = _local2 + (q.boxes[n].x / 8);
n++;
}
}
});
FlowBox.prototype.moveBox = function (num) {
var _local3 = this;
var _local1 = q.aboxes[num];
_local1.timer = _local1.timer + 1;
if (_local1.timer <= _local1.timerMax) {
if (_local1.steps == 0) {
var _local2 = scurve((_local1.timer / 2) / _local1.timerMax) * 2;
} else if (_local1.steps == (_local1.mpath.length - 1)) {
var _local2 = (scurve(((_local1.timer / 2) + (_local1.timerMax / 2)) / _local1.timerMax) * 2) - 1;
} else {
var _local2 = _local1.timer / _local1.timerMax;
}
_local1.x = _local1.ox + ((q.boxunit * _local1.mpath[_local1.steps][0]) * _local2);
_local1.y = _local1.oy + ((q.boxunit * _local1.mpath[_local1.steps][1]) * _local2);
_local1.z = _local1.oz + ((q.boxunit * _local1.mpath[_local1.steps][2]) * _local2);
_local1.x = _local1.x + ((((-q.boxunit) / 2) * (_local1.mpath[_local1.steps][2] * ((cos((_local2 * PI) / 2) + sin((_local2 * PI) / 2)) - 1))) * cos(_local1.addface));
_local1.y = _local1.y + ((((-q.boxunit) / 2) * (_local1.mpath[_local1.steps][2] * ((cos((_local2 * PI) / 2) + sin((_local2 * PI) / 2)) - 1))) * sin(_local1.addface));
_local1.z = _local1.z + ((q.boxunit / 2) * ((abs(_local1.mpath[_local1.steps][0]) + abs(_local1.mpath[_local1.steps][1])) * ((cos((_local2 * PI) / 2) + sin((_local2 * PI) / 2)) - 1)));
_local1.spin = ((-PI) / 2) * _local2;
_local1.locateRote(_local3.face);
_local1.draw(_local1.face, _local1.spin);
_local1.ColorShade(_local1.colorGrade());
_local1.stackDepth(_local3.face);
if (_local1.timer == _local1.timerMax) {
_local1.steps = _local1.steps + 1;
if (_local1.steps == _local1.stepNum) {
_local3.boxInit(num);
} else {
_local3.BoxRefresh(_local1);
}
}
}
};
FlowBox.prototype.BoxRefresh = function (box) {
var _local1 = box;
if ((_local1.Steps != (_local1.mpath.length - 1)) and (_local1.Steps != 0)) {
_local1.timerMax = 8;
} else {
_local1.timerMax = 16;
}
_local1.timer = 0;
_local1.ox = _local1.x;
_local1.oy = _local1.y;
_local1.oz = _local1.z;
if (_local1.mpath[_local1.Steps][2] == 0) {
_local1.addface = atan2(_local1.mpath[_local1.Steps][1], _local1.mpath[_local1.Steps][0]);
} else {
_local1.addface = atan2(_local1.mpath[_local1.Steps - 1][1], _local1.mpath[_local1.Steps - 1][0]);
}
_local1.face = _local1.iface + _local1.addface;
};
FlowBox.prototype.boxInit = function (num) {
var _local1 = num;
if (q.boxer < 7) {
q.boxer = q.boxer + 1;
q.aboxes[_local1] = q.boxes[q.boxer];
q.aboxes[_local1].mpath = q.movePaths[q.boxer];
q.aboxes[_local1].stepNum = q.aboxes[_local1].mpath.length;
q.aboxes[_local1].steps = 0;
this.BoxRefresh(q.aboxes[_local1]);
} else {
q.aboxes[_local1] = 0;
}
};
FlowBox.prototype.stackBoxes = function () {
var _local2 = this;
q.boxes = q.oboxes;
n = 0;
while (n < 8) {
var _local1 = q.boxes[n];
_local1.ixyz(_local1.x, _local1.y, _local1.z);
_local1.iface = _local2.face;
_local1.mpath = q.movePaths[n];
_local1.addface = atan2(_local1.mpath[0][1], _local1.mpath[0][0]);
n++;
}
};
FlowBox.prototype.paths = function (pathSet) {
switch (pathset) {
case 0 :
q.movePaths[0] = new Array(new Array(1, 0, 0), new Array(0, 0, -1), new Array(1, 0, 0), new Array(1, 0, 0), new Array(1, 0, 0), new Array(1, 0, 0), new Array(1, 0, 0), new Array(1, 0, 0));
q.movePaths[1] = new Array(new Array(0, 1, 0), new Array(0, 0, -1), new Array(0, 1, 0), new Array(0, 1, 0), new Array(0, 1, 0), new Array(0, 1, 0), new Array(0, 1, 0), new Array(0, 1, 0));
q.movePaths[2] = new Array(new Array(0, -1, 0), new Array(0, 0, -1), new Array(0, -1, 0), new Array(0, -1, 0), new Array(0, -1, 0), new Array(0, -1, 0), new Array(0, -1, 0), new Array(0, -1, 0));
q.movePaths[3] = new Array(new Array(-1, 0, 0), new Array(0, 0, -1), new Array(-1, 0, 0), new Array(-1, 0, 0), new Array(-1, 0, 0), new Array(-1, 0, 0), new Array(-1, 0, 0), new Array(-1, 0, 0));
q.movePaths[4] = new Array(new Array(-1, 0, 0), new Array(-1, 0, 0), new Array(-1, 0, 0));
q.movePaths[5] = new Array(new Array(0, 1, 0), new Array(0, 1, 0));
q.movePaths[6] = new Array(new Array(0, -1, 0), new Array(0, -1, 0), new Array(1, 0, 0));
q.movePaths[7] = new Array(new Array(1, 0, 0), new Array(1, 0, 0), new Array(1, 0, 0));
return;
case 1 :
this.paths(0);
n = 0;
for(;;){
if (n >= 8) {
break;
}
var _local1 = q.movePaths[n];
_local1.reverse();
var _local2 = _local1.length;
m = 0;
while (m < _local2) {
_local1[m][0] = _local1[m][0] * -1;
_local1[m][1] = _local1[m][1] * -1;
_local1[m][2] = _local1[m][2] * -1;
m++;
}
n++;
};
}
};
FlowBox.prototype.boxLayout = function (layoutSet) {
var _local3 = q.boxunit / 2;
switch (layoutSet) {
case 0 :
q.oboxes[0].xyz(_local3, -_local3, _local3);
q.oboxes[1].xyz(_local3, _local3, _local3);
q.oboxes[2].xyz(-_local3, -_local3, _local3);
q.oboxes[3].xyz(-_local3, _local3, _local3);
q.oboxes[4].xyz(-_local3, -_local3, -_local3);
q.oboxes[5].xyz(-_local3, _local3, -_local3);
q.oboxes[6].xyz(_local3, -_local3, -_local3);
q.oboxes[7].xyz(_local3, _local3, -_local3);
return;
case 1 :
this.boxLayout(0);
_local3 = q.boxunit;
n = 0;
while (n < 8) {
var _local2 = q.oboxes[n];
var _local1 = q.movePaths[n];
var ML = _local1.length;
m = 0;
while (m < ML) {
_local2.x = _local2.x - (_local1[m][0] * _local3);
_local2.y = _local2.y - (_local1[m][1] * _local3);
_local2.z = _local2.z - (_local1[m][2] * _local3);
m++;
}
n++;
}
q.oboxes.reverse();
q.movePaths.reverse();
}
};
FlowBoxArc = function () {
now = boxProps;
q.__proto__ = now;
below = boxProps;
q.links = new Array(new Link("MultiBoxArc", "o"), new Link("BoxArc", "x"));
};
FlowBoxArc.prototype = new FlowBox();
FlowBoxArc.prototype.Enter = function (letter) {
q.waitcount = 1;
q.slowswitch = 1;
switch (letter) {
case "x" :
this.basicInitialize(0);
return;
case "o" :
this.basicInitialize(1);
}
};
FlowBoxArc.prototype.switchCondition = function (letter) {
if (q.halt == 1) {
return(1);
}
};
FlowBoxArc.prototype.Exit = function () {
};
FlowBoxArc.prototype.atmosphere = function () {
};
FlowBoxArc.prototype.initialize = function () {
};
Birdbox = function (p, unit, topcolr, btmcolr, shadow, formbase) {
var _local1 = this;
_local1.superClass = BasicCube;
_local1.superClass(p, unit, topcolr, btmcolr, shadow, formbase);
_local1.addLid(btmcolr);
_local1.center = new Point(_local1);
_local1.center.z = _local1.unit / 4;
_local1.openInc = 0;
_local1.headCount = 0;
_local1.state = 1;
_local1.headCountMax = 75;
};
Birdbox.ptype(BasicCube);
Birdbox.prototype.distanceTest = function () {
var _local1 = Pyt(this.vx - cursor.vx, this.vy - cursor.vy);
if (_local1 > 300) {
return(1);
}
return(undefined);
};
Birdbox.prototype.run = function () {
var _local1 = this;
_local1.iopen = _local1.open;
switch (_local1.state) {
case 1 :
_local1.headCount = _local1.headCount + 1;
if (_local1.headCount >= 4) {
if (_local1.headCount == 4) {
_local1.head.appear();
}
if (_local1.head.head.form.hittest(_xmouse, _ymouse, true) or (_local1.headCount == _local1.headCountMax)) {
_local1.state = 2;
} else if (_local1.openInc < 1) {
_local1.openInc = ((_local1.openInc + 0.1) + _local1.openInc) / 2;
if (_local1.openInc > 1) {
_local1.openInc = 1;
}
_local1.open = (((6 * PI) / 4) * (scurve((_local1.openInc / 2) + 0.5) - 0.5)) * 2;
}
}
break;
case 2 :
if (_local1.openInc > 0.001) {
_local1.openInc = ((_local1.openInc - 0.1) + _local1.openInc) / 2;
if (_local1.openInc < 0.001) {
_local1.openInc = 0.001;
}
_local1.open = (((6 * PI) / 4) * (scurve((_local1.openInc / 2) + 0.5) - 0.5)) * 2;
} else {
_local1.state = 0;
_local1.head.disappear();
}
}
if (_local1.open != _local1.iopen) {
_local1.drawLid(_local1.open);
var fac = scurve(_local1.openInc);
_local1.head.flex = fac;
_local1.center.z = (((-_local1.unit) * 2) / 3) + ((1.33333333333333 * _local1.unit) * scurve(_local1.openInc));
_local1.center.locate();
_local1.head.setNeckScale(fac);
}
_local1.head.mouseTrack(cursor);
_local1.head.neckTilt = (-PI) / 2;
_local1.head.Draw(_local1.head.pheadRote, _local1.head.pheadTilt, _local1.face, _local1.head.neckTilt, 1, 4, 1);
var _local2 = _local1.head.head;
var _local3 = _local1.head.neck;
if (_local1.openInc < 0.5) {
if ((_local1.lid.sideface == -1) and (_local1.hinge.sinTilt > 0)) {
_local2.fore(_local1.sides[4], 2);
_local3.fore(_local1.sides[4], 1);
} else {
_local2.fore(_local1.sides[4], 2);
_local3.fore(_local1.sides[4], 1);
_local1.lid.aft(_local1.sides[4], 1);
}
} else {
_local2.fore(_local1.sides[4], 10);
_local3.fore(_local1.sides[4], 1);
}
m = 0;
while (m < 4) {
_local1.sides[m].fore(_local1.sides[4], m + 4);
m++;
}
};
MultiBoxArc = function () {
now = boxProps;
q.__proto__ = now;
below = boxProps;
q.links = new Array(new Link("flowBoxArc", "f"));
q.scl = 0.15;
q.r = 3;
q.lw = 7 * q.scl;
q.eyeR = 0;
q.headX = 32 * q.scl;
q.neckX = -21 * q.scl;
q.headR = q.r / 2;
q.headLngth = q.r * 1.5;
};
MultiBoxArc.prototype = new Being();
MultiBoxArc.prototype.Initialize = function () {
};
MultiBoxArc.prototype.Enter = function (letter) {
var _local2 = this;
q.BirdBoxes = new Array();
q.boxunit = q.boxunit / 2;
m = 0;
while (m < 8) {
q.birdboxes[m] = new BirdBox(_local2, q.boxunit, 10, 11, 1);
var _local1 = q.birdboxes[m];
_local1.XYZ(was.boxes[m].x, was.boxes[m].y, q.boxunit);
_local1.locateRote(_local2.face);
_local1.center.locate();
if (sin(was.boxes[m].face) > 0) {
_local1.face = was.boxes[m].face + PI;
} else {
_local1.face = was.boxes[m].face;
}
_local1.basicDraw(_local1.face, 0);
_local1.setDepth();
_local1.iColorShade(3);
_local1.colorShade(_local1.colorGrade());
_local1.head = new BirdHead(_local1, _local1.center, q.headR, q.headLngth, q.eyeR, "loop", 0, q.headx, q.neckx, q.lw, 0);
_local1.head.disappear();
_local1.head.neck.fore(_local1.sides[4], 1);
_local1.head.head.fore(_local1.sides[4], 2);
m++;
}
q.waitcount = 10;
q.aboxes = new Array(0, 0);
q.possBoxes = new Array(0, 1, 2, 3, 4, 5, 6, 7);
q.boxmax = 1;
};
MultiBoxArc.prototype.Run = function () {
q.count = q.count + 1;
if (q.count == 200) {
q.boxmax = q.boxmax + 1;
q.count = 0;
}
bn = 0;
while (bn < q.boxMax) {
if ((q.possBoxes.length > 0) or (q.aboxes[bn] != 0)) {
if ((q.possBoxes.length > 0) and (q.aboxes[bn] == 0)) {
var _local1 = random(q.possBoxes.length);
q.aboxes[bn] = q.BirdBoxes[q.possBoxes[_local1]];
q.possBoxes.splice(_local1, 1);
}
q.aboxes[bn].run();
if (q.aboxes[bn].state == 0) {
q.aboxes[bn] = 0;
}
}
bn++;
}
if (((q.possBoxes.length == 0) and (q.aboxes[0] == 0)) and (q.aboxes[1] == 0)) {
q.wrap = 1;
}
};
MultiBoxArc.prototype.atmosphere = function () {
};
MultiBoxArc.prototype.switchCondition = function () {
if (q.wrap == 1) {
return(1);
}
};
Being.prototype.Go = function () {
var _local1 = this;
_local1.arcRun();
_local1.run(cursor);
_local1.atmosphere();
};
Part.prototype.colorGrade = function () {
return(((this.py + 50) - filmspace.py) / 350);
};
Being.prototype.Atmosphere = function () {
this.colorShade(this.colorGrade());
};
Being.prototype.arcRun = function () {
var _local1 = this;
if (changeLetter != 0) {
if (q.segueSwitch == 0) {
if (_local1.switchCondition(changeLetter)) {
q.counter = q.activelink.outSegLength;
q.segueSwitch = 1;
}
}
if (q.segueSwitch == 1) {
if (q.counter == 0) {
if (_local1.changeCondition(changeLetter) == 1) {
_local1.ArcSwitch();
}
} else if (_local1.segueCondition(changeLetter)) {
q.counter = q.counter - 1;
_local1.segue(q.counter / q.activelink.outSegLength, changeLetter);
}
}
}
if ((q.segueSwitch == -1) and (_local1.segueCondition(currentLetter) or (q.activelink.inSegLength == 0))) {
if ((q.counter == q.activelink.inSegLength) or (q.activelink.inSegLength == 0)) {
q.counter = 0;
_local1.SegueCap();
q.segueSwitch = 0;
currentLetter = changeLetter;
changeLetter = 0;
menu.reset();
} else {
q.counter = q.counter + 1;
_local1.segue(q.counter / q.activelink.inSegLength, currentLetter);
}
}
};
Being.prototype.ArcSwitch = function () {
willSwitch = 0;
this.transform(eval (q.activelink.form));
var LL = q.links.length;
n = 0;
while (n < LL) {
if (q.links[n].letter == currentLetter) {
q.activeLink = q.links[n];
}
n++;
}
q.segueSwitch = -1;
routePlace = routePlace + 1;
};
Being.prototype.transform = function (newBeing) {
var _local1 = this;
_local1.exit(changeLetter);
cleanUp();
was = q.valueOf();
q = function () {
};
_local1.__proto__ = new newBeing();
_local1.initialize(q);
_local1.enter(currentLetter);
};
cleanUp = function () {
eggToy.form.removeMovieClip();
eggToy.build(4);
eggToy.form.createEmptyMovieClip("avatarForm", 10);
eggToy.shadow.createEmptyMovieClip("avatarShadow", 11);
eggToy.avatar.form = eggToy.form.avatarForm;
eggToy.avatar.shadow = eggToy.shadow.avatarShadow;
};
_root.onEnterFrame = function () {
cursor.update(eggToy, 500);
routeRun();
eggToy.avatar.go(cursor);
};
_root.onLoad = function () {
_root.form = _root;
scale = 10;
Layout = new Layout();
cursor = new Cursor();
buildPalette();
q = function () {
};
q.segueswitch = 0;
eggToy = new Cell(beginArc, 3, 4);
dustTarget = eggToy.avatar;
currentLetter = "o";
changeLetter = 0;
Route = new Array("e", "h", "k", "j", "y", "n", "v", "p", "a", "z", "w", "b", "q", "s", "x", "f", "o", "f", "x", "d", "x", "m", "x");
RoutePlace = 0;
};
routeRun = function () {
q.routeCounter = q.routeCounter + 1;
if (q.routeCounter > q.waitCount) {
if (q.segueSwitch == 0) {
if (routeplace == route.length) {
routeplace = 0;
}
var _local2 = Route[RoutePlace];
var _local3 = q.links.length;
l = 0;
while (l < _local3) {
if (q.links[l].letter == _local2) {
var _local1 = q.links[l];
q.activelink = _local1;
changeLetter = _local2;
q.routeCounter = 0;
return;
}
l++;
}
}
}
};
ArcList = new Array("Egg", "Hopper", "Stomper", "Jumper", "Triwalker", "SmallRunner", "TallRunner", "Cyclist", "SmallWalker", "Centipede", "ConeHead", "PodRoller", "Spinner", "HandStander", "Roto", "WindMill", "BeanBag", "PodSack", "Birdsack", "Box", "FlowBox", "BoxWagon", "BoxWalker");
m = 0;
while (m < ArcList.length) {
var props = eval (ArcList[m] + "Properties");
Set(ArcList[m] + "props", new props());
m++;
}
buildPalette = function () {
Palette = new Array();
n = 0;
while (n <= 14) {
Palette[n] = new kolor();
n++;
}
Palette[0].hex = "0xC6EFFF";
Palette[1].hex = "0x99C0C9";
Palette[2].hex = "0x909090";
Palette[3].hex = "0x0076A0";
Palette[4].hex = "0x006696";
Palette[5].hex = "0x80a0c6";
Palette[6].hex = "0x6c97b2";
Palette[7].hex = "0x90b7c9";
Palette[8].hex = "0xFFFFFF";
Palette[9].hex = "0x32C8DC";
Palette[10].hex = "0x64E6F0";
Palette[11].hex = "0x00AAB4";
Palette[12].hex = "0x00A6E0";
Palette[13].hex = "0x00E0A6";
Palette[14].hex = "0x0090B9";
n = 0;
while (n < Palette.length) {
Palette[n].kolorBreak();
n++;
}
};
Symbol 12 MovieClip [puffCircle] Frame 1