Frame 1
maxtilt = 2;
starspeed = 12;
stagewidth = 550;
ampl = 0.5;
amplHor = 1;
tril_hor_freq = 8;
accelerationstep = 0.05;
speed_back_to_middle = 0.8;
backward_driving = 1;
road._visible = false;
function sign(n) {
return(((n < 0) ? -1 : 1));
}
function bias(p, factor) {
var _local3 = factor / Math.abs(factor);
factor = 1 + (0.05 * Math.min(100, Math.abs(factor)));
var _local2 = ((_local3 == 1) ? (1 - Math.abs(Math.pow(1 - p, factor))) : (Math.pow(p, factor)));
return(_local2);
}
function circleMc(point, r, r2, pen, nm, dpt) {
var _local2 = _root.createEmptyMovieClip(nm, dpt);
drawCircle(point, r, r2, pen, _local2);
}
function drawCircle(point, r, r2, pen, mc) {
var x = point.x;
var y = point.y;
with (mc) {
lineStyle(pen.thickness, pen.colour, pen.alpha);
moveTo(x - r, y);
var afw = 1.08;
var hoek = -225;
i = 0;
while (i < 4) {
var cx = (x + ((afw * r) * Math.cos(d2r(hoek + 22.5))));
var cy = (y - ((afw * r2) * Math.sin(d2r(hoek + 22.5))));
var px = (x + (r * Math.cos(d2r(hoek))));
var py = (y - (r2 * Math.sin(d2r(hoek))));
curveTo(cx, cy, px, py);
hoek = hoek - 45;
i++;
}
}
}
function d2r(deg) {
return((deg / 180) * Math.PI);
}
function angle(xa, xb, ya, yb) {
return((((-2 * (yb < ya)) + 1) * ((-2 * (xb > xa)) + 1)) * (((xb < xa) * 180) - (57.2957795130823 * Math.atan(Math.abs(yb - ya) / Math.abs(xb - xa)))));
}
function dist(xa, xb, ya, yb) {
return(Math.sqrt(((xa - xb) * (xa - xb)) + ((ya - yb) * (ya - yb))));
}
Pen = function (thickness, colour, alpha) {
this.thickness = thickness;
this.colour = colour;
this.alpha = alpha;
};
Point = function (x, y) {
this.x = x;
this.y = y;
};
mid = new Point(0, 626 - road._y);
small = new Point(227.5, 258.5);
big = new Point(383.5, 430.5);
thick = 22;
thin = 0.5;
ease = -200;
OvalTween = function (mc, mid, small, big, thick, thin, fract, ease) {
this.ovalmc = mc.createEmptyMovieClip("oval" + mc.getNextHighestDepth(), mc.getNextHighestDepth());
this.fract = fract;
this.pos = mid;
this.startsize = small;
this.endsize = big;
this.startthick = thick;
this.endthick = thin;
this.ease = ease;
};
OvalTween.prototype.draw = function () {
var _local6 = 1 - bias(this.fract, this.ease);
var _local2 = 1 - bias(this.fract, this.ease);
var _local3 = this.startthick + (_local6 * (this.endthick - this.startthick));
var _local5 = this.startsize.x + (_local2 * (this.endsize.x - this.startsize.x));
var _local4 = this.startsize.y + (_local2 * (this.endsize.y - this.startsize.y));
var _local7 = new Pen(_local3, 0, 100);
this.ovalmc.clear();
drawCircle(this.pos, _local5, _local4, _local7, this.ovalmc);
};
OvalTween.prototype.step = function (df) {
this.fract = this.fract + df;
if (this.fract < 0) {
this.fract = this.fract + 1;
} else if (this.fract > 1) {
this.fract = this.fract - 1;
}
};
aaOvals = 20;
ovallist = [];
var i = 0;
while (i < aaOvals) {
var ov = new OvalTween(road.ovalsMc, mid, small, big, thick, thin, i / aaOvals, ease);
ovallist.push(ov);
i++;
}
function movestars(dx) {
var _local1 = 0;
while (_local1 < stars) {
stars[_local1]._x = stars[_local1]._x + dx;
_local1++;
}
rx = road._x;
_local1 = 0;
while (_local1 < 2) {
s0 = stars[_local1];
s1 = stars[(_local1 + 1) % 2];
s0._x = s0._x + dx;
if ((((dx > 0) and (s0._x > (-rx))) and (s0._x < (stagewidth - rx))) and (s1._x > s0._x)) {
s1._x = s0._x - s1._width;
s1.gotoAndStop(_local1 + 1);
}
if ((((dx < 0) and ((s0._x + s0._width) > (-rx))) and ((s0._x + s0._width) < (stagewidth - rx))) and (s1._x < s0._x)) {
s1._x = s0._x + s0._width;
}
_local1++;
}
}
road.stars0._x = (-road._x) - 2;
road.stars1._x = road.stars0._x + road.stars0._width;
stars = [road.stars0, road.stars1];
acceleration = 0;
turndir = 0;
curve = 0;
speed = 0;
turn = function (dir) {
if (dir == 0) {
if (Math.abs(curve) < 0.5) {
dir = (0.5 * speed) * sign(curve);
} else {
dir = (speed_back_to_middle * speed) * sign(curve);
}
}
curve = curve - ((speed * dir) * curvestep);
curve = Math.max(-1, Math.min(1, curve));
var _local2 = 1 + int((0.5 * (curve + 1)) * totalframes);
road.gotoAndStop(_local2);
};
accelerate = function (dir) {
if (dir == 0) {
dir = -0.5 * sign(speed);
}
speed = speed + (dir * accelerationstep);
speed = Math.min(Math.max(-backward_driving, speed), 1);
if (Math.abs(speed) < 0.05) {
speed = 0;
}
road._rotation = (curve * speed) * maxtilt;
};
function tril(ampl) {
if (road._y > roady) {
road._y = roady - ampl;
} else {
road._y = roady + ampl;
}
}
function trilHor(amplHor) {
if (road._x > roadx) {
road._x = roadx - amplHor;
} else {
road._x = roadx + amplHor;
}
}
totalframes = road._totalframes;
tiltstep = maxtilt / (totalframes / 2);
midframe = int(0.5 + (totalframes / 2));
curvestep = 2 / totalframes;
road.gotoAndStop(midframe);
roady = road._y;
roadx = road._x;
counter = 0;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if (_local1 == 37) {
turndir = -1;
}
if (_local1 == 39) {
turndir = 1;
}
if (_local1 == 38) {
acceleration = 1;
}
if (_local1 == 40) {
acceleration = -1;
}
if (_local1 == 27) {
fscommand ("quit", 0);
}
};
keyListener.onKeyUp = function () {
var _local1 = Key.getCode();
if ((_local1 == 37) or (_local1 == 39)) {
turndir = 0;
}
if ((_local1 == 38) or (_local1 == 40)) {
acceleration = 0;
}
};
Key.addListener(keyListener);
cross._visible = false;
cursor._visible = false;
onMouseDown = function () {
startx = _xmouse;
starty = _ymouse;
mousedown = true;
};
onMouseUp = function () {
lijn.clear();
acceleration = 0;
turndir = 0;
mousedown = false;
};
Frame 2
var j = 0;
while (j < ovallist.length) {
ovallist[j].draw();
j++;
}
road._visible = true;
Frame 3
var j = 0;
while (j < ovallist.length) {
ovallist[j].draw();
ovallist[j].step(speed / 48);
j++;
}
if (mousedown) {
acceleration = 1;
if (Math.abs(startx - _xmouse) > 10) {
if (startx > _xmouse) {
turndir = -1;
} else {
turndir = 1;
}
} else {
turndir = 0;
}
}
accelerate(acceleration);
turn(turndir);
tril(ampl * speed);
counter++;
if ((counter % tril_hor_freq) == 0) {
trilHor(amplHor * speed);
} else {
road._x = roadx;
}
movestars((curve * speed) * starspeed);
Frame 4
gotoAndPlay ("loop");
Symbol 7 MovieClip Frame 1
stop();
Symbol 68 MovieClip Frame 1
stop();
Symbol 69 MovieClip Frame 1
function onSelectURLItem(obj, menuItem) {
getURL (menuItem.url, "_blank");
}
var items = [];
items[0] = {label:"it will never be the same .com"};
items[1] = {label:"by Rafa\u00EBl Rozendaal, 2004", url:"http://www.newrafael.com"};
items[2] = {label:"programming by Reinier Feijen", url:"http://www.boxofchocolates.nl"};
var defaultItems = {zoom:true, quality:true, loop:false, play:false, print:true, rewind:false, forwardAndBack:false, save:true};
var enableTextItems = false;
var myContextMenu = new ContextMenu();
var i = 0;
while (i < items.length) {
var item = new ContextMenuItem(items[i].label, function () {
});
if (items[i].separatorBefore != null) {
item.separatorBefore = items[i].separatorBefore;
}
if (items[i].url != null) {
item.url = items[i].url;
item.onSelect = onSelectURLItem;
} else {
item.enabled = enableTextItems;
}
myContextMenu.customItems.push(item);
i++;
}
for (var s in defaultItems) {
myContextMenu.builtInItems[s] = defaultItems[s];
}
this._parent.menu = myContextMenu;