• home
  • forum
  • my
  • kt
  • download
  • Falling Snow Effect

    Author: 2008-10-14 09:27:29 From:

    In this article we are going to design Falling Snow Effect in macromedia now Adobe Flash. You follow simple steps below…

    Create a new document

    Create a new document. Set background color to #FFEAF4. Set the width and height of your movie to be 400(width) by 300(height). You can define your document size depending on background image you are using. Here I am using snow-house image (see figure - snow-house.jpg) whose size is 400px by 300px. So I have kept my document size as per size of image I am using.

    Image

    Figure - snow-house.jpg

    Set your frame rate to 35 frames per second. Frame rate defines speed of falling snow. More the frame rate faster the speed and vice versa.

    Now import your background image to library. You can do it as follows…

    File > Import > Import to Library…

    Image

    Drag it from library and set it as background of your document. Keep image X-Y position to ‘0’ so image get properly align.

    Create Snow

    Now we are going to generate Snow. Press Ctrl+F8 or Insert > New Symbol… to add new symbol. Name it ‘snow’. Modify its property as per following figure…

    Image

    Now select movie clip ‘snow’ form library by double clicking it. Now select Oval tool and set Stroke Color is set to No Color, and that the Fill Color is set to White.

    Image

    Draw a small circle. Press shift button for perfect Circle. Set its property as shown below…

    You can modify width and Height as you wish. And align to ‘0’ will better.

    Image

    Select ‘Scene 1’. And drag movie clip ‘snow’ form library. And modify its property. Give it an instance name as ‘snow’. Refer fig 5.

    Image

    Now go to action panel by pressing F9 or through Windows > Actions paste following piece of code (code 1) there.

    Code 1

    onClipEvent (load) {
    if (this._name == “snow”) {
    _parent.i = 0;
    }

    this._alpha = _parent.randRange(80, 100); //Alpha Transparency of snow
    this._width = _parent.randRange(5, 10); //Snow width
    this._height = this._width; //Keep round shaped snow
    this._x = _parent.randRange(-100, _parent.mw+100);
    this._y = _parent.randRange(0, -50);
    speed = _parent.randRange(2, 5); //Folling speed.

    }

    onClipEvent (enterFrame) {

    this._y += speed;
    this._x += _parent.interval-3;

    if (this._y>_parent.mh+20) {
    this.removeMovieClip();
    }
    }

    Now create a new movie clip ‘snow_bit’ same as you do for ‘snow’. Drag ‘snow_bit’ on ‘Scene 1’. Give it an instance name as ‘snow_bit’.

    Select first frame of ‘Scene 1’ and add following source code to action panel.

    Code 2

    speed1 = .9;
    mw = 400; //Movie Width
    mh = 300; //Movie Height

    snowdrop = 50; //the larger the interval is, lesser it’s going to snow

    function randRange(min, max) {
    var randomNum = Math.round(Math.random()*(max-min))+min;
    return randomNum;
    }
    setInterval(CursorMovement, 40);

    function CursorMovement() {
    snow_bit._x = speed1*(snow_bit._x-_xmouse)+_xmouse;
    interval = (snow_bit._x/mw*6);
    }

    function snowfall() {
    i++;
    duplicateMovieClip(snow, [“snow”+i], i);
    }
    setInterval(snowfall, snowdrop);

    Now publish .swf file. You can do it through

    File > Publish Preview > Flash / HTML or press F12

    Source Code:

    Download Source code for ‘ Falling Snow Effect

    Download

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      3D (20)
      Math Physics (14)
      3rd Party (5)
      Navigation (60)
      Actionscripting (26)
      Optimization (16)
      Animation (32)
      Projector (9)
      Audio (46)
      Special Effects (140)
      Backend (26)
      Text Effects (82)
      Drawing (32)
      Tips and Techniques (47)
      Dynamic Content (31)
      Tricks (8)
      Games (97)
      Utilities (21)
      Getting Started (91)
      Video (24)
      Interactivity (43)
      Web Design (29)

    New

    Hot