A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [CS3] Bitmap particle effects without a black background

  1. #1
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988

    [CS3] Bitmap particle effects without a black background

    Okay, this has been bothering me for some time, and I was just curious if I'm barking up the wrong tree and should just use sprite/movie clips based particle effects.

    I've been looking at a lot of neat particle effects in AS3. Some of them are sprite/movie clips based, while others are bitmap based. However, I recently noticed that most of the really awesome bitmap particle effects have been on a black background. If you change the color of the background, you'll see the particles actually fade to black.

    I have attempted to alter some of these bitmap "fade to black" examples to make them alpha out with no real success. So, my question is this: Does anyone know of a way to slowly fade out a particle effect using bitmapData AND have it alpha out so you can place it over top of a non-solid colored background?

  2. #2
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Just had to code this the other day
    Code:
    var fadeMatrix:Array = [1,0,0,0,0,
    			0,1,0,0,0,
    			0,0,1,0,0,
    			0,0,0,0.8,0];
    fadeDown=new ColorMatrixFilter(fadeMatrix);
    So that's your filter, and you just apply it every ( Or every other ) frame to your playField bitmap, eg

    canvas.bitmapData.applyFilter(canvas.bitmapData,ca nvas.bitmapData.rect,qPoint,fadeDown);

    ( Where qPoint has been defined else where as qPoint=new Point(0,0); )

    To alter the speed of the fade, play with the 0.8 value in the matrix.

    Squize.

  3. #3
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    Cool beans.

    Thanks Squize.

    If I'm ever in London, I owe you a pint.

    (Is that what you say over there?)

    -pXw

  4. #4
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Nearly, the actual phrase you wanted was "I owe you 8 pints. And a kebab".

    Cool, glad it worked for you mate.

    Squize.

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