Hello,

I am a Flash newbie, but an experienced programmer (C/C++).

My requirement is to have an arrowhead traveling along a specific path on
the stage, leaving a trail behind.  As the arrowhead moves along, the trail
left behind needs to progressively fade.  The oldest part starts fading
first, so it is always the most faded.

By the time the arrowhead reaches its destination the "oldest" part of the
trail, furthest from the arrowhead, should be quite transparent, maybe an
alpha value of 10% or so, and the "newest" part of the trail, adjacent to
the arrowhead, should be a solid 100%.

The motion of the arrowhead was made by an animator.  I need to work with
that.

I am currently doing this as follows:
1. I start out by initializing a Shape, with a thick solid (red) line style.
2. I set the drawing pen position at the initial position of the arrowhead
using moveTo()
3. One each ENTER_FRAME event, I use lineTo() to draw a line to the current
position of the arrowhead.

And so on.

So what I would like to do is in each frame, after several frames have
elapsed, is to start fading the oldest line segment, then a couple of frames
later start fading the second-oldest, while continuing to further fade the
oldest, etc.

Is it possible to access the older lines?  I know how to fade the entire
Shape (trapezoid?) but not specific segments.

I tried the method of creating a new Shape every frame, just a line segment,
that I accumulate in an array.  That way I can fade them all separately
according to how old they are.  However the problem I had with this was that
the lines end up overlapping at a point, because I was doing the following.

Frame n:
create new segment
moveTo( 100, 100 )  // the previous position of the arrowhead
lineTo( 104, 104 )  // the current position of the arrowhead

Frame n + 1:
create new segment
moveTo( 104, 104 )  // the previous position of the arrowhead
lineTo( 100, 108 )  // the current position of the arrowhead

So both of the lines share a point at (104, 104).  As I fade out the lines
by decreasing their alpha values, it seems at this shared spot the alpha
values have an additive effect, and the spot is more opaque.  So the end
result is that while the path is incrementally faded as I want it to be, it
is punctuated with these thick spots.  I don't want those, I just want a
smooth continuous incremental fading.

Is there a way to access the pixels of that spot, where the two lines
intersect, and fade them to some transparency level?  The lines are a few
pixels thick (maybe 2 or 3 or more, depending on what the client likes) so
that interecting point is not just a single pixel.

I also tried staggering the starting point of each new segment, based on the
direction of the line, so that it doesn't overlap with the previous line.
But this was really ugly and jagged looking.  There may be an intelligent
algorithm or heuristic for this but I don't have the time or budget to make
a big deal of this.


Here is a link to help clarify things.  It doesn't satisfy the requirement,
since there is no incremental fading, it is all equally faded except for the
line attached to the arrowhead.  It also doesn't exactly employ the methods
I describe above, it is just one of my many trials incorporating a few
technquies.  I am just linking it to help this discussion.  If, on the other
hand, it is confusing please ignore it.
http://arka.sunnyday.jp/script/escort/hokkaido_01.html

Thanks,
Arka Roy
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to