The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: what would be the best way to generate trails?

  1. #1

    what would be the best way to generate trails?

    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??
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  2. 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/a...ionary536.html

    I'll see if I can find a good example.

  3. #3
    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.

  4. #4
    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....
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  5. #5

  6. #6
    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.
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  7. Quote Originally Posted by bluemagica View Post
    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.
    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.

  8. #8
    Quote Originally Posted by ArmoredSandwich View Post
    Vector based graphics are freaking slow, get used to it or use copyPixels.
    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.

  9. #9
    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.

  10. #10
    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...
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  11. #11
    That tut really just shows you the basics, its up to you to make the appropiate changes based on what you need.

  12. #12
    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):

    http://lab.wx3.com/defender/

    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.

  13. Quote Originally Posted by justkevin View Post
    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):

    http://lab.wx3.com/defender/

    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.
    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!

  14. #14
    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.
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  15. #15
    Quote Originally Posted by bluemagica View Post
    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.
    Any resources for AS3 as well? I would love to get a crack at it.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012