Search code examples
actionscript-3flashmouseblit

Solid deformed shape mouse trail in AS3


I'm trying to duplicate this type of mouse trail. I can't tell if it's deforming a movie clip or drawing separate objects on the stage. I can duplicate it at slow speeds, but at a fast speeds I have no idea how they're doing it.

The MouseEvent.MOUSE_MOVE is way to slow on the update to draw exactly where the mouse is going so I tried using curveTo to create a curve but unfortunately you still hit a point where you get a sharp angle.


Solution

  • Looking over it for a few seconds, they are probably blitting(drawing) that small mc to a butmapdata object every frame while at the same time dimming the bitmapdata by making the alpha of the whole bitmap smaller by a perchantage, not sure exatcly how much, please experiment for that.

    So, use:

    BitmapData.draw to draw the movieclip somewhere on the bitmap and

    BitmapData.coloTransform to change the decrase the alpha of the whole image by 1% or so every frame...

    so just set every multiplier to 1.0 until you get to alpha and set alpha as say, 0.98. just perform that color transform every frame and over time, the "trail" of the old mc's that were blitted will fade away.

    ColorTransform class

    code snipet, with compile errors probably, just to give you an idea of how to attempt this:

    function onEventFrame(e:Event){
         bitmap.colorTransform(new Rectangle(0,0, 300,300), new ColorTransform(1.0, 1.0, 1.0 , 0.98));
         bitmap.draw(dotMC, bla bla bla);
    }
    

    If you get stuck, consult the as3 reference link supplied above or some tutorial on the net if you can find one.