/* Animation for the SSWF web site -- written by Alexis Wilke for Made to Order Software, Ltd (c) 2002-2005 */

/*

Copyright (c) 2002-2005 Made to Order Software, Ltd.

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

*/


screen_width = 280;
screen_height = 100;

rectangle "screen" { 0, 0, screen_width, screen_height };

points "s_pts" {
	-12.4, 19.2, -12.7, 16.1;
	-13, 9.4, -19.9, 9.1;
	-26.9, 9.6, -27.5, 15.7;
	-27.4, 21.7, -23.2, 23.2;
	-19.7, 32.2, -9.4, 35.6;
	-0.4, 37.5, 7, 35.6;
	18.8, 30.9, 19.1, 21.5;
	18.9, 10.1, -7, -12.8;
	-9, -14.8, -9, -17.8;
	-8.8, -20.4, -4.3, -21.1;
	-1, -21.5, 1.8, -21;
	7.2, -20, 8.3, -18.8;
	9.3, -11.8, 16.5, -11.5;
	22.4, -11.7, 22.8, -18.3;
	22.4, -24.9, 13.8, -24.7;
	9.5, -28.9, -1.7, -28.9;
	-18.6, -28.8, -17.8, -15.3;
	-18.4, -7.9, 3.6, 9.8;
	10.1, 15.3, 10, 21.3;
	9.6, 25.5, 3.8, 26.8;
	-1.3, 27.8, -5.9, 27.3;
	-12.2, 26.1, -14.6, 21.2;
};
points "w_pts" {
	-20.1, -26.1, -20.5, -29.3;
	-21.3, -34.6, -27.9, -34.7;
	-34.9, -33.4, -35.3, -27.7;
	-35.1, -21.1, -30.2, -20.8;
	-22.9, 28.9;
	-24, 31.5, -22.9, 35.1;
	-20.7, 39.2, -17.5, 39;
	-13.8, 39.1, -11.5, 36.3;
	-10, 33.7, -10.6, 31.6;
	-1.5, 6;
	6.1, 26.9;
	4.7, 30.2, 5.4, 33.4;
	7.4, 38.1, 11.7, 39.2;
	16.9, 40.1, 19.5, 36.2;
	20.8, 33.4, 20.7, 30.9;
	20.6, 27.7, 19.6, 26.5;
	29.6, -21.3;
	33.1, -23.1, 33.3, -27.8;
	32.8, -33.7, 27.1, -34.1;
	20.7, -33.9, 20, -28.9;
	19.4, -24.6, 22.1, -21.9;
	12.9, 20;
	4.7, 0.2;
	5.4, -1.9, 5.5, -4.7;
	4.9, -10.9, -0.5, -11.2;
	-7.8, -11.1, -8.2, -6;
	-8.3, -2.3, -7.5, 0;
	-15.6, 21.4;
	-22.5, -23.3;
};
points "f_pts" {
	-24.8, 27.4, -24.8, 30.9;
	-24.8, 36.8, -18.7, 37.4;
	-12.2, 37.3, -11.6, 31.9;
	-11.1, 26.8, -14.3, 24.9;
	-14.3, -4.1;
	0.5, -4.2;
	1.7, -2.3, 4, -2.1;
	10, -2.3, 10.4, -7.6;
	10.3, -14, 5.3, -14.6;
	1.9, -14.9, 0.1, -12.5;
	-13.9, -12.5;
	-13.9, -26;
	11.2, -26;
	12.8, -24.3, 15.8, -24.2;
	21.2, -24.5, 21.3, -30.6;
	21, -36.1, 16.1, -36.7;
	11.1, -36.5, 10.1, -34.1;
	-19, -34;
	-22.4, -33.9, -22.6, -30.3;
	-22.6, 25.4;
};


fill style "fill_white" { sswf.col.white; };

shape "s" {
	rect { -29, -30, 24, 37.5 };
	fill_white; move: -14.6, 21.2; s_pts;
};
shape "w" {
	rect { -36.5, -36, 34.5, 40.5 };
	fill_white; move: -22.5, -23.3; w_pts;
};
shape "f" {
	rect { -28, -39, 24, 40 };
	//show_bounds: true;
	//show_origin: true;
	fill_white; move: -22.6, 25.4; f_pts;
};


sprite "s1" {
	place object {
		id: s;
		depth: 1;
	};
	show frame;
	max = 100;
	for(idx = 1; idx <= max; idx + 1) {
		replace object {
			depth: 1;
			matrix { scale: abs(idx - max / 2.0) / (max / 2.0); }
		};
		show frame;
	};
};

sprite "s2" {
	place object {
		id: s;
		depth: 1;
	};
	show frame;
	max = 75;
	for(idx = 1; idx <= max; idx + 1) {
		replace object {
			depth: 1;
			matrix { scale: 1, abs(idx - max / 2.0) / (max / 2.0); }
		};
		show frame;
	};
};

sprite "w1" {
	place object {
		id: w;
		depth: 1;
	};
	show frame;
	max = 85;
	for(idx = 1; idx <= max; idx + 1) {
		replace object {
			depth: 1;
			//matrix { scale: abs(idx - max / 2.0) / (max / 2.0), 1; }
			matrix { rotate: 3.14159 * 2.0 * idx / max; };
		};
		show frame;
	};
};

sprite "f1" {
	place object {
		id: f;
		depth: 1;
		matrix { translate: 0, -90; };
	};
	show frame;
	max = 60;
	for(idx = 1; idx <= max; idx + 1) {
		replace object {
			depth: 1;
			matrix { translate: 0, 180.0 * idx / max - 90; }
		};
		show frame;
	};
};

sprite "sswf_anim" {
	place object {
		id: s1;
		depth: 1;
		matrix { translate: -70, 0; };
	};
	place object {
		id: s2;
		depth: 2;
		matrix { translate: -10, 0; };
	};
	place object {
		id: w1;
		depth: 3;
		matrix { translate: 60, 0; };
	};
	place object {
		id: f1;
		depth: 4;
		matrix { translate: 130, 0; };
	};
	show frame;
};


sound "sswf_spoken" {
	"sswf.wav";
	format: "uncompressed";
};


sequence "main"
{
	frame_rate = 30;
	screen;

	set background color { sswf.col.black };

	/*
	 * this action is useful so a rewind doesn't just sit there
	 * if someone uses it - a rewind will rerun the fading effect
	 */
	do action { action "play"; };

	s;
	w;
	f;
	s1;
	s2;
	w1;
	f1;
	sswf_anim;

	replace object {
		depth: 1;
		id: sswf_anim;
		matrix { translate: 110, 50; };
		color transform { scale: 0, 0, 0, 0 };
	};

	max = 25;
	for(idx = 1; idx <= max; idx + 1) {
		show frame;
		replace object {
			depth: 1;
			color transform { scale: 1, 1, 1, idx * 1.0 / max; };
		};
	};

	// put the sound later so the animation starts right away
	// (i.e. in a flash movie, the order counts)
	sswf_spoken;
	sound info {
		id: sswf_spoken;
		loop: 5;
	};

	do action { action "stop"; };
	show frame;
};