# Wind/Particle Effect for DisplayObjects

**URL:** <https://forum.kirupa.com/t/wind-particle-effect-for-displayobjects/280109>\
**Category:** open source\
**Created:** [January 22, 2009, 7:51pm UTC](https://forum.kirupa.com/t/wind-particle-effect-for-displayobjects/280109 "2009-01-22T19:51:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skineh](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@skineh](https://forum.kirupa.com/u/skineh)\
**Post date:** [January 22, 2009, 7:51pm UTC](https://forum.kirupa.com/t/wind-particle-effect-for-displayobjects/280109/1 "2009-01-22T19:51:39Z")

</div>

Wanted to take a break from a larger project I’m working on, so this morning I made a wind effect. No real reason outside of having a distraction. It works on any display object, and has several properties to control how the effect looks. Accessors include:

[LIST]  
[_] **emitter** : The source of the wind (point)  
[_] **speed** : The strength of the wind  
[_] **variance** : Variance of the wind’s speed  
[_] **behavior** : “fixed” and “grow” are the options. Either the wind blows out to a fixed radius, or it carries across the screen indefinitely  
[_] **radius** : If “fixed” is the behavior, then radius defines how far out the wind reaches.  
[_] **friction** : Once a particle is outside of the wind’s area of effect, friction controls its slowdown rate.  
[\*] **smear** : Leaves a trail as particles are pushed about, looking like smears or magnetic particulate matter collecting.  
[/LIST]There are 3 methods: blow(), stop() and reset(). Should be pretty obvious.

Instantiation is done by passing the display object in the constructor then adding to the stage.

```auto

var wind:WindEffect = new WindEffect(someDO);
addChild(wind);

```

Real small class (and a throwaway particle class), along w/ a SWF example. The example uses the mouse, but it’s just as easy to animate through code by controlling the wind emitter or automate using the class’s “grow” behavior. Throws a complete event when all particles are off the screen if you like that sort of thing. Not much else to say, it’s a simple class. Enjoy!
