home *** CD-ROM | disk | FTP | other *** search
- <html>
- <head>
- <title>Visual Effects</title>
- <script language="JavaScript">
- <!-- begin script
- var emptyFrame = '<html></html>';
- var hexchars = '0123456789ABCDEF';
- function fromHex (str) {
- var high = str.charAt(0);
- var low = str.charAt(1);
- return (16 * hexchars.indexOf(high)) +
- hexchars.indexOf(low);
- }
- function toHex (num) {
- return hexchars.charAt(num >> 4) + hexchars.charAt(num & 0xF);
- }
- function Color (str) {
- this.red = fromHex(str.substring(0,2));
- this.green = fromHex(str.substring(2,4));
- this.blue = fromHex(str.substring(4,6));
- this.toString = ColorString;
- return this;
- }
- function ColorString () {
- return toHex(this.red) + toHex(this.green) + toHex(this.blue);
- }
- function BodyColor (bgColor,fgColor,linkColor,vlinkColor,alinkColor) {
- this.bgColor = bgColor;
- this.fgColor = fgColor;
- this.linkColor = linkColor;
- this.vlinkColor = vlinkColor;
- this.alinkColor = alinkColor;
- this.toString = BodyColorString;
- return this;
- }
- function BodyColorString () {
- return '<body' +
- ((this.bgColor == null) ? '' : ' bgcolor="#' + this.bgColor + '"') +
- ((this.fgColor == null) ? '' : ' text="#' + this.fgColor + '"') +
- ((this.linkColor == null) ? '' : ' link="#' + this.linkColor + '"') +
- ((this.vlinkColor == null) ? '' : ' vlink="#' + this.vlinkColor + '"') +
- ((this.alinkColor == null) ? '' : ' alink="#' + this.alinkColor + '"') +
- '>';
- }
- function Alternator (bodyA, bodyB, text) {
- this.bodyA = bodyA;
- this.bodyB = bodyB;
- this.currentBody = "A";
- this.text = text;
- this.toString = AlternatorString;
- return this;
- }
- function AlternatorString () {
- var str = "<html>";
- with (this) {
- if (currentBody == "A") {
- str += bodyA;
- currentBody = "B";
- }
- else {
- str += bodyB;
- currentBody = "A";
- }
- str += text + '</body></html>';
- }
- return str;
- }
- function Event (start, loops, delay, action) {
- this.start = start * 1000;
- this.next = this.start;
- this.loops = loops;
- this.loopsRemaining = loops;
- this.delay = delay * 1000;
- this.action = action;
- return this;
- }
- function EventQueue (name, delay, loopAfter, loops, stopAfter) {
- this.active = true;
- this.name = name;
- this.delay = delay * 1000;
- this.loopAfter = loopAfter * 1000;
- this.loops = loops;
- this.loopsRemaining = loops;
- this.stopAfter = stopAfter * 1000;
- this.event = new Object;
- this.start = new Date ();
- this.loopStart = new Date();
- this.eventID = 0;
- this.addEvent = AddEvent;
- this.processEvents = ProcessEvents;
- this.startQueue = StartQueue;
- this.stopQueue = StopQueue;
- return this;
- }
- function AddEvent (event) {
- this.event[this.eventID++] = event;
- }
- function StartQueue () {
- with (this) {
- active = true;
- start = new Date();
- loopStart = new Date();
- loopsRemaining = loops;
- setTimeout (name + ".processEvents()", this.delay);
- }
- }
- function StopQueue () {
- this.active = false;
- }
- function ProcessEvents () {
- with (this) {
- if (!active) return;
- var now = new Date();
- if (now.getTime() - start.getTime() >= stopAfter) {
- active = false;
- return;
- }
- var elapsed = now.getTime() - loopStart.getTime();
- if (elapsed >= loopAfter) {
- if (--loopsRemaining <= 0) {
- active = false;
- return;
- }
- loopStart = new Date();
- elapsed = now.getTime() - loopStart.getTime();
- for (var i in event)
- if (event[i] != null) {
- event[i].next = event[i].start;
- event[i].loopsRemaining = event[i].loops;
- }
- }
- for (var i in event)
- if (event[i] != null)
- if (event[i].next <= elapsed)
- if (event[i].loopsRemaining-- > 0) {
- event[i].next = elapsed + event[i].delay;
- eval (event[i].action);
- }
- setTimeout (this.name + ".processEvents()", this.delay);
- }
- }
- var black = new Color ("000000");
- var white = new Color ("FFFFFF");
- var blue = new Color ("0000FF");
- var magenta = new Color ("FF00FF");
- var yellow = new Color ("FFFF00");
-
- var blackOnWhite = new BodyColor (white, black);
- var whiteOnBlack = new BodyColor (black, white);
- var blueOnWhite = new BodyColor (white, blue);
- var yellowOnBlue = new BodyColor (blue, yellow);
- var magentaOnYellow = new BodyColor (yellow, magenta);
-
- var flashyText = new Alternator (blackOnWhite, whiteOnBlack,
- '<h1 align="center">Flashy text</h1>');
- var dance1 = new Alternator (yellowOnBlue, magentaOnYellow,
- '<h1 align="center">Dancing...</h1>');
- var dance2 = new Alternator (whiteOnBlack, yellowOnBlue,
- '<h1 align="center">Dancing...</h1>');
- var dance3 = new Alternator (new BodyColor(black,yellow), magentaOnYellow,
- '<h1 align="center">Dancing...</h1>');
- var inthe1 = new Alternator (magentaOnYellow, yellowOnBlue,
- '<h1 align="center">...in the...</h1>');
- var inthe2 = new Alternator (blackOnWhite, whiteOnBlack,
- '<h1 align="center">...in the...</h1>');
- var inthe3 = new Alternator (yellowOnBlue, blueOnWhite,
- '<h1 align="center">...in the...</h1>');
- var streets1 = new Alternator (whiteOnBlack, yellowOnBlue,
- '<h1 align="center">...streets!</h1>');
- var streets2 = new Alternator (blueOnWhite, magentaOnYellow,
- '<h1 align="center">...streets!</h1>');
- var streets3 = new Alternator (yellowOnBlue, blackOnWhite,
- '<h1 align="center">...streets!</h1>');
-
- var flashEvent = new Event (0, 10, 0.1,
- 'self.head.location="javascript:parent.flashyText"');
- var d1e = new Event (0, 10, .1,
- 'self.f1.location="javascript:parent.dance1"');
- var d2e = new Event (5, 10, .1,
- 'self.f2.location="javascript:parent.dance2"');
- var d3e = new Event (10, 10, .1,
- 'self.f3.location="javascript:parent.dance3"');
- var i1e = new Event (3, 10, .1,
- 'self.f1.location="javascript:parent.inthe1"');
- var i2e = new Event (8, 10, .1,
- 'self.f2.location="javascript:parent.inthe2"');
- var i3e = new Event (13, 10, .1,
- 'self.f3.location="javascript:parent.inthe3"');
- var s1e = new Event (6, 10, .1,
- 'self.f1.location="javascript:parent.streets1"');
- var s2e = new Event (11, 10, .1,
- 'self.f2.location="javascript:parent.streets2"');
- var s3e = new Event (16, 10, .1,
- 'self.f3.location="javascript:parent.streets3"');
-
- var evq = new EventQueue ("evq", 0.1, 20, 10, 60);
- evq.addEvent (flashEvent);
- evq.addEvent(d1e);
- evq.addEvent(i1e);
- evq.addEvent(s1e);
- evq.addEvent(d2e);
- evq.addEvent(i2e);
- evq.addEvent(s2e);
- evq.addEvent(d3e);
- evq.addEvent(i3e);
- evq.addEvent(s3e);
-
-
- function initialize () {
- evq.startQueue();
- }
- // end script -->
- </script>
- <frameset rows="52,52,52,52,*" onLoad="initialize()">
- <frame name="head" src="javascript:parent.emptyFrame"
- marginwidth=1 marginheight=1 scrolling="no" noresize>
- <frame name="f1" src="javascript:parent.emptyFrame"
- marginwidth=1 marginheight=1 scrolling="no" noresize>
- <frame name="f2" src="javascript:parent.emptyFrame"
- marginwidth=1 marginheight=1 scrolling="no" noresize>
- <frame name="f3" src="javascript:parent.emptyFrame"
- marginwidth=1 marginheight=1 scrolling="no" noresize>
- <frame name="body" src="javascript:parent.emptyFrame">
- </frameset>
- <noframes>
- <h2 align="center">Netscape 2.0 or other JavaScript-enabled browser required</h2>
- </noframes>
- </html>
-