# Motion algorithm

**URL:** <https://forum.kirupa.com/t/motion-algorithm/263311>\
**Category:** Uncategorized\
**Created:** [June 14, 2008, 10:44am UTC](https://forum.kirupa.com/t/motion-algorithm/263311 "2008-06-14T10:44:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dom\_1](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@Dom\_1](https://forum.kirupa.com/u/Dom_1)\
**Post date:** [June 14, 2008, 10:44am UTC](https://forum.kirupa.com/t/motion-algorithm/263311/1 "2008-06-14T10:44:12Z")

</div>

hi, i’m trying to get some particles moving in a nice random motion style, unfortunatly the only two types of random motion i know are [brownian motion and motion you get using perlin noise. It so happens that brownian motion doesnt look that nice, and the [URL=“http://www.sjeiti.com/?p=305”]as3 perlin noise classes by ron valstar](http://en.wikipedia.org/wiki/Brownian_motion) run pretty slow when animating 1000 particles.

so, does anyone know how I could get some pretty random “nice” looking motion, I’m running out of google searches. :sen:

thanks

---

<div class="post-metadata">

**Author:** ![zuperxtreme](https://avatars.discourse-cdn.com/v4/letter/z/e9a140/32.png) [@zuperxtreme](https://forum.kirupa.com/u/zuperxtreme)\
**Post date:** [June 14, 2008, 5:15pm UTC](https://forum.kirupa.com/t/motion-algorithm/263311/2 "2008-06-14T17:15:17Z")

</div>

What exactly are you trying to do?

Here’s some particle movement:  
[http://www.zeuslabs.us/2006/05/09/introduction-to-particle-systems-using-actionscript-3/](http://www.zeuslabs.us/2006/05/09/introduction-to-particle-systems-using-actionscript-3/)

---

<div class="post-metadata">

**Author:** ![Dom\_1](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@Dom\_1](https://forum.kirupa.com/u/Dom_1)\
**Post date:** [June 15, 2008, 2:09pm UTC](https://forum.kirupa.com/t/motion-algorithm/263311/3 "2008-06-15T14:09:06Z")

</div>

I was trying to do [this](http://www.signalsondisplay.com/blog/?p=9).  
I just used sin/cos waves for each particle, and it looks pretty random, although it’s not, it does the trick though.  
It will be needing more work to make it better.

phwhitfield, would you have any pointers on learning about strange attractors and such ? everytime I try and get into it, I really don’t know where or how to start.  
cheers

---

<div class="post-metadata">

**Author:** ![dthought](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dthought/32/3573_2.png) [@dthought](https://forum.kirupa.com/u/dthought)\
**Post date:** [June 15, 2008, 2:38pm UTC](https://forum.kirupa.com/t/motion-algorithm/263311/4 "2008-06-15T14:38:58Z")

</div>

I wouldn’t bother writing your own… too complex and time consuming. Use one that already exists 🙂 This is the effect you’re after, albeit with more particles and some darkening when not near the light areas of the face:

[http://flintparticles.org/examples/mutual-gravity](http://flintparticles.org/examples/mutual-gravity)

---

<div class="post-metadata">

**Author:** ![Dom\_1](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@Dom\_1](https://forum.kirupa.com/u/Dom_1)\
**Post date:** [June 15, 2008, 2:58pm UTC](https://forum.kirupa.com/t/motion-algorithm/263311/5 "2008-06-15T14:58:58Z")

</div>

I’ve seen the examples for that engine already, it’s not really what I’m after. What i was really trying to achieve was some sweet flocking motion like you see alot in robert hodgin’s videos… thats didnt work out, so i just “modified” the brownian motion code a little to make it look a little smoother.

---

<div class="post-metadata">

**Author:** ![rumblesushi](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rumblesushi](https://forum.kirupa.com/u/rumblesushi)\
**Post date:** [June 15, 2008, 3:13pm UTC](https://forum.kirupa.com/t/motion-algorithm/263311/6 "2008-06-15T15:13:55Z")

</div>

Those flint examples had terrible performance.

The particle engine I wrote has like 6000 particles running at 60 fps.

Dom - are you using 100% bitmap rendering? Because with only 1200 particles, I would have thought it would faster than it does, I’m only getting around 20fps.

---

<div class="post-metadata">

**Author:** ![Dom\_1](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@Dom\_1](https://forum.kirupa.com/u/Dom_1)\
**Post date:** [June 15, 2008, 3:22pm UTC](https://forum.kirupa.com/t/motion-algorithm/263311/7 "2008-06-15T15:22:45Z")

</div>

well i set the fla to 20fps since i’m using a timer to update every 5ms. I got it up to 3354 with still the same performance.  
but no, i’m constantly drawing a sprite that’s not been added to the display list, but contains all the particles being drawn to the bitmapData (if that makes any sense)
