A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: blurry particle trails

  1. #1
    will i ever get it?
    Join Date
    Feb 2004
    Posts
    707

    blurry particle trails

    i am creating a very simple particle system. My only issue is trying to create a blurry trail effect on the particles in motion. I started by creating a large bitmap container, and applying a colormatrix filter and a blur filter . It seems to do the trick , but the issue now, is i have to make this container cover the stage, which has a two unwanted a effects:
    -it's slower
    -it covers all the content beneath. Perhaps my approach to creating trails is wrong?

    i can post the whole class, but before i litter this post with long lines of code, is there a way to place a bitmapdata drawing over content and still get the desired effect. NOTE, if make transparency false in the bmdata, i loose the effect

  2. #2
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    there's really no way around the slowness. that's a very heavy process. maybe importing sprites (image files) that are already blurry?

    try changing the blend mode on the holder clip.
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  3. #3
    Member
    Join Date
    Feb 2009
    Location
    Paris
    Posts
    79
    I didn't catch the "cover" issue, maybe a picture or some code will be more clear...

    Anyway, the solution with the slowness is often to precalculate bitmaps as Phix said : ie to cache all states of you particle in an asset and load it to a BitmapData.
    Also, you can do it dynamically by code : I m working with Shapes drawing API and filters too for my sprites, for each state, I draw the Shape, apply the filters, etc. and use the BitmapData.draw(myShape) to "convert" it to BitmapData.
    As I prefer to work with one BitmapData for all the states I memorize position of each sprite within the BitmapData with a Rectangle. At the end of the precalculating process, I end up with one Array of Rectangle and one BitmapData. Maintaining an index, I loop through the Array and use copyPixels accordingly to animate my sprite.

    Btw, try first to use powers of 2 on your blurX/blurY and don't exceed 8 to see if it speeds things up.
    And also, it s better to deal with little Bitmaps (each with one paticle) than one big Bitmap, you accelerate things by copying less transparent pixels.

    Hope that s clear... if not, I ll post an example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center