AS3 particle effect

Discussion in 'Web Design and Development' started by phadam, Jul 15, 2009.

  1. phadam macrumors regular

    Jan 21, 2009
    Anybody know of any particle effect tutorials i can follow in as3??? I would like to use one as a background on my site but I can only seem to find as1 and as2 tutorials. Still a learning process for me :)

    here is a link to what i am looking for

    ive done some searching and found other useful tutorials but still no luck on the particle effect. thanks
  2. snickelfritz macrumors 65816


    Oct 24, 2003
    Tucson AZ
    I followed the tutorial and changed the code to AS3.
    Works pretty well.

    var xMin:int = 0;
    var xMax:int = 550;
    var yMin:int = 0;
    var yMax:int = 400;
    var minSize:int = 10;
    var maxSize:int = 50;
    var easeFactor:int = 10;
    var randomX:int = Math.random () * ( xMax - xMin ) + xMin;
    var randomY:int = Math.random () * ( yMax - yMin ) + yMin;
    var randomSize:int = Math.random () * ( maxSize - minSize ) + minSize;
    var distance:int = Math.sqrt(Math.pow(this.x-randomX, 2)+Math.pow(this.y-randomY, 2));
    if (Math.abs(this.width-maxSize)>1)
    	this.width += (randomSize-this.width)/2;
    	this.height += (randomSize-this.height)/2;
    if (distance>1)
    	this.x += (randomX-this.x)/easeFactor;
    	this.y += (randomY-this.y)/easeFactor;
    } else
  3. lucidmedia macrumors 6502a

    Oct 13, 2008
    Wellington, New Zealand
    The book:

    Foundation Actionscript 3.0 Animation: Making Things Move! by Keith Peters

    has a nice chapter on writing particle systems.

    Also, it may be worth looking at things like Flint:
  4. phadam thread starter macrumors regular

    Jan 21, 2009
    awesome. works great. i may head down to the book store this weekend. I'll definitely check out that book by Keith Peters.

    Thanks guys. the site is really coming along. slowly but getting there :)
  5. Kelon macrumors member

    Jul 14, 2009
    Yes, the book above is one of the best I've come across for focussed tutorials on making things move. It's by FriendsofED publishing. It's a bit dry and lots of maths, but the animation possibilities that open up are awesome. Some of my best work resulted form studying that book.

Share This Page