/** * @(#) $RCSfile: StarryStarryNightInit.as,v $ $Revision: 1.3 $ $Date: 2003/03/05 15:17:41 $ * * 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. */ /** * Init script for a single animated star. * * @author Olaf Havnes * @version $Revision: 1.3 $ $Date: 2003/03/05 15:17:41 $ * @since SWFIT1.0 */ // Are we the original clip ? if (_name eq "star") { _visible = false; stop (); } // Hide the sub clips for now. birth._visible = false; growth._visible = false; death._visible = false; /** * Life cycle data. */ // Parameters for our life cycle. INCUBATE_MAX_LEN = 20; SPARKLE_MAX_LEN = 70; GROW_MAX_LEN = 120; FADE_MAX_LEN = 60; INCUBATE_MIN_LEN = 0; SPARKLE_MIN_LEN = 40; GROW_MIN_LEN = 40; FADE_MIN_LEN = 30; // Set our specific life cycle incubate = INCUBATE_MIN_LEN + random (INCUBATE_MAX_LEN - INCUBATE_MIN_LEN); sparkle = incubate + SPARKLE_MIN_LEN + random (SPARKLE_MAX_LEN - SPARKLE_MIN_LEN); glow = sparkle + GROW_MIN_LEN + random (GROW_MAX_LEN - GROW_MIN_LEN); fade = glow + FADE_MIN_LEN + random (FADE_MAX_LEN - FADE_MIN_LEN); // Start counting frames. life = 0; /** * Movement data. */ // The basic speeds are common for all particles. INCUBATE_SPEED = 0.3; SPARKLE_SPEED = 0.2; GLOW_SPEED = 0.2; FADE_SPEED = 0.1; // Parameters for the (cyclic) erratic movement. AMPLITUDE_MAX = 30; AMPLITUDE_MIN = 15; AMPLITUDE_Y_DIVISOR = 2.0; // Pick a specific amplitude for the (cyclic) erratic movement. amplitude = AMPLITUDE_MIN + random (AMPLITUDE_MAX - AMPLITUDE_MIN); // Parameters for our path through that amplitude. AMPLITUDE_MAX_STEPS = 60; AMPLITUDE_MIN_STEPS = 30; // Pick a specific number of steps through that amplitude. steps = AMPLITUDE_MIN_STEPS + random (AMPLITUDE_MAX_STEPS - AMPLITUDE_MIN_STEPS); /** * Movement data - is empty, as we get the x/y coordinates from _parent when she clones us. */ /** * We're not going to mess with sin/cos functions here - instead we use the * following iterating formula - see StarryStarryNightLoop.as for the rest of the * algorithm: */ s = Math.sin (Math.PI / steps); s_0 = 0; c_0 = amplitude; s_1 = amplitude * s; c_1 = amplitude * Math.cos (Math.PI / steps); reverse_dir = random (50) > 25;