StarryStarryNightLoop Actionscript

Table of contents | Previous document | Download StarryStarryNightLoop.as | SWF!T Homepage

RCSfile: StarryStarryNightLoop.as,v  Revision: 1.2  Date: 2003/03/03 05:15:49  

Copyright 2003 Orgdot AS. All Rights Reserved. http://dev.swfit.com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.


Loop script for a single animated star.
author      Olaf Havnes
version     Revision: 1.2  Date: 2003/03/03 05:15:49  
since       SWFIT1.0


Iterating algorithm based on the double angle formulas.


s_2 = s_0 + 2 * s * c_1;
c_2 = c_0 - 2 * s * s_1;

s_0 = s_1;
c_0 = c_1;

s_1 = s_2;
c_1 = c_2;

life ++;

if (life < incubate)
{
   y -= INCUBATE_SPEED;
}
else if (life < sparkle)
{
   y -= SPARKLE_SPEED;
   birth._visible = true;
   growth._visible = false;
   death._visible = false;
}
else if (life < GLOW)
{
   y -= GLOW_SPEED;
   birth._visible = false;
   growth._visible = true;
   death._visible = false;
}
else if (life < FADE)
{
   y -= FADE_SPEED;
   birth._visible = false;
   growth._visible = false;
   death._visible = true;    
}
else
{
   removeMovieClip ("");
}


if (reverse_dir)
{
   _x = int (x + s_2);
   _y = int (y + c_2 / AMPLITUDE_Y_DIVISOR);
}
else
{
   _x = int (x + c_2);
   _y = int (y + s_2 / AMPLITUDE_Y_DIVISOR);
}