    /* Animation for the SSWF web site -- written by Alexis Wilke for Made to Order Software Corp. (c) 2002-2007 */
    /* This animation shows a NEW symbol with a star like line around it */

    /*

    Copyright (c) 2002-2007 Made to Order Software Corp.

    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.

    */

    // sizes without the enlargement animation
    // 243x168 (113 + 126 + 4, 94 + 62 + 12)
    screen_width = 113 + 126 + 4;
    screen_height = 94 + 62 + 12;

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

    points "n_pts" {
    	  3.1 + ox,  -7.0,   5.0 + ox, -22.9;
    	 -7.8 + ox, -21.4, -11.8 + ox, -13;
    	-12.7 + ox, -10.5, -10.3 + ox, -11.4;
    	-11.1 + ox,  -9.5, -14.1 + ox, -9.5;
    	-18.7 + ox,  -9.4, -17.9 + ox, -11.9;
    	-17.0 + ox, -14.9, -14.0 + ox, -17.1;
    	 -3.5 + ox, -24.6,  10.1 + ox, -25.9;
    	 12.1 + ox, -19.4,  14.7 + ox, -13.7;
    	 17.9 + ox,  -8.3,  22.1 + ox, -3.3;
    	 25.8 + ox,   1.0,  25.8 + ox, -1.8;
    	 26.7 + ox, -10.5,  28.1 + ox, -21.5;
    	 28.7 + ox, -24.3,  30.0 + ox, -25.8;
    	 35.2 + ox, -26.1;
    	 32.9 + ox, -26.1,  26.0 + ox, 9.3;
    	 19.9 + ox,   4.8,   8.3 + ox, -15.8;
    	  6.9 + ox,  -4.6,   4.8 + ox, 6.4;
    	  5.8 + ox,   7.5,   8.3 + ox, 6.7;
    	  5.8 + ox,   9.1,  -0.6 + ox, 8.8;
    };
    points "e_pts" {
    	4.1, 9.8, -2.1, 8.9;
    	-7.9, 8.2, -8.1, 0.8;
    	-7.4, -9.6, 3.6, -11.2;
    	9.4, -11.7, 10.1, -5.2;
    	-3, 1.1;
    	-1.7, 6, 2.1, 5.9;
    	5, 5.9, 7.3, 3.4;
    };
    points "e_pts_inside" {
    	-3.1, 0;
    	-2.8, -6.5, 0.1, -8.5;
    	3.1, -10.5, 4, -3.2;
    };
    points "w_pts" {
    	-10.8, 6.7, -7.6, 9.1;
    	-1.9, -1.6, -0.6, -2;
    	0.9, 4.6, 4.3, 9.2;
    	10, 5.6, 21.1, -16.5;
    	22.2, -19.2, 18.9, -19;
    	15.8, -18.7, 12.3, -16.3;
    	15.7, -17.4, 16.9, -14.7;
    	19.2, -10, 6.9, 3.7;
    	2.8, 6.6, 3.1, -11.9;
    	0, -11.5, -3.4, -9.2;
    	0, -6.6, -1.3, -3.5;
    	-4.6, 3, -6, 3.9;
    	-8.7, -3.6, -9, -12;
    	-12.4, -11.5, -15.2, -8.9;
    };
    points "star_pts" {
    	-64, -65;
    	-35, -42;
    	-19, -91;
    	-4, -44;
    	41, -76;
    	31, -35;
    	98, -55;
    	65, -16;
    	123, 4;
    	67, 10;
    	73, 49;
    	35, 23;
    	14, 52;
    	-1, 23;
    	-34, 59;
    	-40, 21;
    	-97, 40;
    	-68, 3;
    	-109, -15;
    	-65, -30;
    };

    fill style "fill_black" { sswf.col.black; };
    fill style "fill_yellow" { sswf.col.yellow; };
    line style "line_thin_black" { 0.1; sswf.col.black; };

    shape "n_letter" {
    	ox = -16;
    	rect { -20 + ox, -30, 36 + ox, 11 };
    	//show_bounds: true;
    	//show_origin: true;
    	fill_black; move: -0.6 + ox, 8.8; n_pts;
    };
    shape "e_letter" {
    	rect { -12, -14, 12, 11 };
    	fill_black;
    		move: 7.3, 3.4; e_pts;
    		move: 4, -3.2; e_pts_inside;
    };
    shape "w_letter" {
    	rect { -18, -21, 24, 11 };
    	fill_black; move: -15.2, -8.9; w_pts;
    };
    shape "star" {
    	rect { -113, -94, 126, 62 };
    	//show_bounds: true;
    	//show_origin: true;
    	fill_yellow; line_thin_black; move: -65, -30; star_pts;
    };

    ////////////////////////////////////////////////////
    // The N, e and w letters
    // We create seperate sprites so we can animate them
    // separatly (see the swap/swap_letter functions below)
    ////////////////////////////////////////////////////
    sprite "ns" { place object { id: n_letter; depth: 1; }; show frame; };
    sprite "es" { place object { id: e_letter; depth: 1; }; show frame; };
    sprite "ws" { place object { id: w_letter; depth: 1; }; show frame; };

    ////////////////////////////////////////////////////
    // So we can (could - we don't at this time) access
    // the star by itself, make it a sprite
    ////////////////////////////////////////////////////
    sprite "star_sprite" {
    	place object {
    		id: star;
    		depth: 1;
    	};
    	show frame;
    };

    ////////////////////////////////////////////////////
    // The "New" text is put in a single sprite so we
    // can work on it at once (see the rotation function
    // below)
    ////////////////////////////////////////////////////
    sprite "new_sprite" {
    	replace object {
    		"n";
    		id: ns;
    		depth: 1;
    		matrix { translate: -24, 0; };
    	};
    	replace object {
    		"e";
    		id: es;
    		depth: 2;
    		matrix { translate: 0, 0; };
    	};
    	replace object {
    		"w";
    		id: ws;
    		depth: 3;
    		matrix { translate: 28, 0; };
    	};
    	show frame;
    };

    ////////////////////////////////////////////////////
    // The new sprite includes the star and the text
    // We can now work on the entire object at once
    // (see the zoom function below)
    ////////////////////////////////////////////////////
    sprite "new" {
    	place object {
    		id: star_sprite;
    		depth: 1;
    	};
    	replace object {
    		"n";
    		depth: 2;
    		id: new_sprite;
    	};
    	do action { action "stop"; };
    	show frame;
    };

    sprite "new_anim" {
    	////////////////////////////////////////////////////
    	//
    	// Change the following variables to make the animations
    	// faster and/or slower - watch out, any value won't
    	// work (swap_intermediate should be "much" smaller than
    	// swap_max)
    	//
    	////////////////////////////////////////////////////
    	//
    	// base -> index starting point
    	// max -> number of frames for this effect
    	zoom_base = 0;
    	zoom_max = 20;

    	swap_base = zoom_base + zoom_max;
    	swap_max = 80;
    	swap_intermediate = 20;		// time before the next letter starts the swapping
    	swap_submax = swap_max - swap_intermediate * 2;

    	rotate_base = swap_base + swap_max;
    	rotate_max = 45;

    	fade_base = rotate_base + rotate_max;
    	fade_max = 20;

    	//
    	////////////////////////////////////////////////////
    	//

    	replace object {
    		"n";			// name of this sprite
    		id: new;
    		depth: 1;
    		matrix { scale: 0.01; };
    	};
    	do action {
    		action "dictionary" {
    			"i";
    			"n";		// 1
    			"t";
    			"f";		// 3
    			"q";
    			"swap_letter";	// 5
    		};
    		action "push data" {
    			lookup: 1;
    			property: "_xscale";
    			float: 1;
    			lookup: 1;
    			property: "_yscale";
    			float: 1;
    			lookup: 1;
    			property: "_alpha";
    			integer: 100;
    			lookup: 3;	// f = "zoom"
    			string: "zoom";
    			lookup: 0;	// i = 0 -- animation index
    			integer: 0;
    		};
    		action "set variable";
    		action "set variable";
    			// we need to reset what we change
    			// otherwise the last value is reused
    		action "set property";	// alpha = 100%
    		action "set property";	// x/y scale = 1%
    		action "set property";
    		function "zoom" {
    			action "push data" {
    				integer: 1;		// continue looping

    				integer: zoom_base + zoom_max;
    				lookup: 0;		// "i"

    				lookup: 1;		// n._yscale = t;
    				property: "_yscale";
    				lookup: 2;		// "t"
    				lookup: 1;		// n._xscale = t;
    				property: "_xscale";
    				lookup: 2;		// "t"
    				lookup: 2;		// t = i x scale;
    				float: 100.0 / zoom_max; // scale from 0 to 100
    				//string: "i";
    				//integer: zoom_base;	// zoom_base == 0 -- not necessary
    				lookup: 0;		// "i"
    			};
    			// change the zoom
    			action "get variable";
    			//action "swap";
    			//action "substract";		// zoom_base == 0 -- not necessary
    			action "multiply";		// t = i * 10.0
    			action "set variable";		// save in temporary ("t")

    			action "get variable";
    			action "set property";		// n._xscale = t;
    			action "get variable";
    			action "set property";		// n._yscale = t;

    			action "get variable";
    			action "equal";
    			action "logical not";
    			action "if true" { "cont"; };
    			action "push data" {
    				lookup: 3;		// "f"
    				string: "swap";
    			};
    			action "set variable";
    			label { "cont"; };

    			action "return";
    		};
    		function "swap_letter(l)" {
    			action "push data" {
    				integer: 0;

    				lookup: 2;		// t -= swap_intermediate
    				integer: -swap_intermediate;
    				lookup: 2;		// "t"

    				integer: swap_submax;
    				lookup: 2;		// "t"
    			};

    			action "get variable";		// swap_submax < t ?
    			action "less than";
    			action "if true" { "done" };
    			action "push data" {
    				integer: 0;
    				lookup: 2;		// "t"
    			};
    			action "get variable";		// 0 > t ?
    			action "swap";
    			action "less than";
    			action "if true" { "done" };

    			// Yes! Let's swap this letter.
    			action "push data" {
    				property: "_xscale";
    				string: "n/n/";		// n.n.$l._xscale = ...;
    				string: "l";
    				lookup: 4;
    				float: 100.0 / (swap_submax / 4.0);
    				lookup: 4;
    				lookup: 4;
    				lookup: 4;
    				float: swap_submax / -4.0 + 1;
    				integer: swap_submax / 2.0;
    				lookup: 2;
    				lookup: 4;
    				integer: 2;
    				float: 1.0 / (swap_submax / 2.0);
    				lookup: 2;
    			};
    			action "get variable";
    			action "decrement";
    			action "multiply";
    			action "int";
    			action "multiply";
    			action "decrement";		// now we have -1 or +1
    			action "set variable";

    			action "get variable";
    			action "decrement";
    			action "swap";
    			action "modulo";
    			action "add";
    			action "swap";
    			action "get variable";
    			action "multiply";
    			action "set variable";		// q = -10 to +10 (at the time of writing)

    			action "get variable";
    			action "multiply";
    			action "set variable";		// q = -100 to +100

    			action "get variable";		// get l
    			action "concatenate";		// n.n.$l
    			action "swap";			// n.n.$l._xscale
    			action "push data" {		// get q back
    				lookup: 4;		// "q"
    			};
    			action "get variable";
    			action "set property";		// n.n.$l._xscale = q;

    			label { "done" };

    			action "get variable";		// t -= swap_intermediate
    			action "add";
    			action "set variable";

    			action "return";
    		};
    		function "swap" {
    			action "push data" {
    				integer: 1;

    				integer: swap_base + swap_max;
    				lookup: 0;		// "i"

    				string: "w";
    				integer: 1;
    				lookup: 5;	// "swap_letter"
    				string: "e";
    				integer: 1;
    				lookup: 5;	// "swap_letter"
    				string: "n";
    				integer: 1;
    				lookup: 5;	// "swap_letter"

    				lookup: 2;		// t = i - swap_base
    				integer: -swap_base;
    				lookup: 0;	// "i"
    			};
    			action "get variable";
    			action "add";
    			action "set variable";		// t = i - swap_base

    			action "call function";
    			action "pop";
    			action "call function";
    			action "pop";
    			action "call function";
    			action "pop";

    			action "get variable";
    			action "equal";
    			action "logical not";
    			action "if true" { "cont"; };
    			action "push data" {
    				lookup: 3;		// "f"
    				string: "rotate";
    			};
    			action "set variable";
    			label { "cont"; };

    			action "return";
    		};
    		function "rotate" {
    			action "push data" {
    				integer: 1;

    				integer: rotate_base + rotate_max;
    				lookup: 0;

    				string: "n/n";
    				property: "_rotation";

    				float: 360.0 / rotate_max;
    				integer: -rotate_base;
    				lookup: 0;
    			};
    			action "get variable";
    			action "add";
    			action "multiply";
    			action "set property";

    			action "get variable";
    			action "equal";
    			action "logical not";
    			action "if true" { "cont"; };
    			action "push data" {
    				lookup: 3;		// "f"
    				string: "fade";
    			};
    			action "set variable";
    			label { "cont"; };

    			action "return";
    		};
    		function "fade" {
    			action "push data" {
    				integer: fade_base + fade_max;
    				lookup: 0;

    				lookup: 1;
    				property: "_alpha";

    				float: -100.0 / fade_max;
    				integer: -(fade_base + fade_max);
    				lookup: 0;
    			};
    			action "get variable";
    			action "add";
    			action "multiply";
    			action "set property";

    			action "get variable";
    			action "equal";
    			action "logical not";

    			action "return";
    		};
    	};
    	show frame { 4 };
    	do action {
    		action "push data" {
    			integer: 0;
    			string: "f";		// function to call

    			string: "i";
    		};
    		action "duplicate";		// (void) i++
    		action "get variable";
    		action "increment";
    		action "set variable";

    		action "get variable";
    		action "call function";		// (bool) (*f)()

    		action "if true" { "repeat"; };	// if (*f)() then
    		action "next frame";		//	previous frame
    		action "branch" { "done" };	// else
    		label { "repeat" };		//	next frame
    		action "previous frame";	// end if
    		label { "done" };

    		action "play";
    	};
    	show frame;
    	// when we reach here the animation is over

    	// wait a bit and play the animation again
    	show frame { 20 };
    };

    sequence "main"
    {
    	frame_rate = 30;
    	compress = false;
    	screen;

    	set background color { sswf.col.white };

    	// The shapes
    	n_letter;
    	e_letter;
    	w_letter;
    	star;

    	// The sprites
    	ns;
    	es;
    	ws;
    	new_sprite;
    	star_sprite;
    	new;

    	// The actual "animation" (this is an action script!)
    	new_anim;

    	replace object {
    		"n";
    		depth: 2;
    		id: new_anim;
    		matrix { translate: 113, 100; };
    	};

    	// there isn't a way to stop this animation since it's
    	// all happening in the sprite object - thus the main
    	// movie doesn't need more than one frame
    	// P.S. the stop is propbably useless
    	do action { action "stop"; };
    	show frame;
    };