2

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.

Any insight on to the technique creating this effect would be greatly appreciated as I'm just beating my head on the desk at this point.

TwinRavens
  • 23
  • 2

1 Answers1

0

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.

Good luck.

Neoraptor
  • 951
  • 1
  • 7
  • 13
  • the website finally loaded, yeah, it's definitely bitmap blitting though you will have to use a little bit of code to make the mc "swerve" like that by creating some kind of speed aware code... I'll leave that to you... – Neoraptor Aug 05 '11 at 20:42
  • Awesome, that was the right way to go about it. Just one more thing, do you know how I can speed up the draw rate? A timer(1) and the MOUSE_MOVE are lagging when I whip across the screen. – TwinRavens Aug 05 '11 at 20:53
  • of course they will be lagging if it's 1 milisecond... make it something realistic like 20-30 ms and it should work. If it's skipping to much, try to "interpolate" by drawing more then one mc in the inbetween points in a for loop... it should "smooth" it out. – Neoraptor Aug 06 '11 at 09:39
  • Another possibility is to draw the mc like 50 times a sec (20 ms) but make the bitmap color transform on 100 ms or maybe 150 ms... it should help with draw speeds and the users won't notice such a small change in alpha so you can get away with it... experiment – Neoraptor Aug 06 '11 at 09:41
  • And don't use mouse move, it's anoying, at least for me. Every mc has a mouseX and mouseY property embeded within it. It calculates the coords based on it's own coordinate system automaticaly for you. – Neoraptor Aug 06 '11 at 09:42