Well, i want to know, how to create image trails via code. The simplest way would be to just duplicate instances and change their alpha…but that can cause a lag if done in excess…so what will be the possible solutions to this? can copyPixels be used here??
I don’t know what kind of trail you are looking for, but I’ve seen some pretty cool stuff with the line method (LineTo() IIRC).
Ah here it is:
http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary536.html
I’ll see if I can find a good example.
You can have a separate bitmap that you copyPixels to, that you can then manipulate in any way you want. Fade it out, blur it out. Not sure of the exact method as i haven’t got my head around copyPixels fully, but i’ve heard that that is how some people have done it. And the performance is extremely good.
err, Armored, by trails i meant mouse-trails, like you have on windows…or the thing you get when you turn on the onion-skin in timeline of an animation. i am not exactly sure how that lineTo will help in this regard though.
and iamtheJuggler, i need a piece of code or an example to understand this…i kindof know the use of copyPixel, but i dont know how i can apply it here…
This might help.
well in that link, they are still just attaching the “particle” to the mc… in as3, while working with “sprite”, things do get lighter…but still trails are just plain images, and i want a way to generate trail from the image itself…if i use separate mc or image for the trail, then eventually it will get slower if i have too many trails. moreover adding a separate image for a trail works when you have a …umm…single image, but if it has animation, then will you add a child for each frame of that animation?so i guess the best way is to somehow, generate the trail from the image itself, but i dont know how to do it.
Well you should have said that, you know, when you make a topic you explain your problem instead of just stating it.
Vector based graphics are freaking slow, get used to it or use copyPixels.
[QUOTE=ArmoredSandwich;2328186]Vector based graphics are freaking slow, get used to it or use copyPixels.[/QUOTE]
I’m with ArmoredSandwich, the best answer in this case is copypixels. gotoAndLearn() had a great tutorial on bitmapdata but the site seems to be down ATM.
It seems up to me. This one looks pretty useful for the mouse trails.
http://gotoandlearn.com/player.php?id=63
It’s not a mousetrail one, but shouldn’t be too hard to use the same concept for a mouse trail.
ah thanks…that helps a lot…i but the way they use it, it affects the entire screen, also the trail seems to go on forever, i know its just to get things started, but still, since i am quite new to flash programming, i need help on how to make it more “trail” like…
That tut really just shows you the basics, its up to you to make the appropiate changes based on what you need.
I’ve used bitmaps layers with good success for trails.
Here’s a simple example for a particle test I did:
http://www.generickevin.com/flash/particles/
If the drawing style is set to line, each particle will be chased by a fading trail.
You can see a more sophisticated version in my PlanetDefender game, with fading smoke trails (you need to build missile complexes to see the effect):
Both use a similar technique:
Create a single bitmap layer over the rest of the action.
As your point/particle moves, draw a line from it to its previous location. Unfortunately, to draw lines on a bitmapData, you’ll need to write your own algorithm. I used a variant of the Bresenham algorithm.
For the simple demo, I just then faded the bitmap each frame using a colorTransform.
For the missile trails in the game, I applied a blur filter every other frame. Also, I added some “noise” to the line drawing algorithm to make it more smoky. Note: Blur is an expensive CPU operation.
[quote=justkevin;2328880]I’ve used bitmaps layers with good success for trails.
Here’s a simple example for a particle test I did:
http://www.generickevin.com/flash/particles/
If the drawing style is set to line, each particle will be chased by a fading trail.
You can see a more sophisticated version in my PlanetDefender game, with fading smoke trails (you need to build missile complexes to see the effect):
Both use a similar technique:
Create a single bitmap layer over the rest of the action.
As your point/particle moves, draw a line from it to its previous location. Unfortunately, to draw lines on a bitmapData, you’ll need to write your own algorithm. I used a variant of the Bresenham algorithm.
For the simple demo, I just then faded the bitmap each frame using a colorTransform.
For the missile trails in the game, I applied a blur filter every other frame. Also, I added some “noise” to the line drawing algorithm to make it more smoky. Note: Blur is an expensive CPU operation.[/quote]
Awesome stuff!
Too bad the guy isn’t looking for that, you should know that if you had read the first post. Oh wait, that’s right! He didn’t say that in the first post!! ><
Anyways, I’m not completely here to ***** about that. Thanks for that stuff and the algorithm names, I’ll look into it!
Well this stuff actually helped a lot! i dont know how to change the topic title, but, one thing i understand is i need bitmapdata for this trails, and i need tuts and resources on bitmapdata for as2, to learn it properly. I know as3 might be more useful here, but since i havent yet learnt as3 fully, please give me some resource/guide from where i can learn this bitmapdata stuff for as2 in detail.
And thanks JustKevin…that was really a awesome help.
[quote=bluemagica;2329232]Well this stuff actually helped a lot! i dont know how to change the topic title, but, one thing i understand is i need bitmapdata for this trails, and i need tuts and resources on bitmapdata for as2, to learn it properly. I know as3 might be more useful here, but since i havent yet learnt as3 fully, please give me some resource/guide from where i can learn this bitmapdata stuff for as2 in detail.
And thanks JustKevin…that was really a awesome help.[/quote]
Any resources for AS3 as well? I would love to get a crack at it.
Too bad the guy isn’t looking for that, you should know that if you had read the first post. Oh wait, that’s right! He didn’t say that in the first post!! ><
LOL.