收录日期:2019/05/20 13:15:50 时间:2009-07-29 18:34:53 标签:flex

I'm working on a Flex application that includes a crawl component -- a block of text that moves across a portion of the screen from right to left, implemented as a Label object being moved by a Move effect across a containing Canvas object. (Okay, technically, at the moment it's an Image object being moved, but as it's an all-text crawl, I'm working to phase-out the image and just present it as text.) As a bit of visual eye candy, I'm trying to fade the text in when it appears and fade it out when it disappears, rather than have obvious sharp edges at either end of the Canvas.

I've largely accomplished this by placing small rectangles at the left and right sides of the Canvas, setting them to the background color, and giving them an alpha gradiant. This works for the majority of situations, and if I don't come up with anything better, I'll gladly roll it into production.

However, when there's a background image/pattern instead of a solid background color, this won't work; there will be two very conspicuous monochromatic blocks on either end of the text crawl. (Note that the background image/pattern applies to the entire application, of which the crawl Canvas is only a single part; when there is an app-wide background image, the crawl's background is transparent.)

The only general solution I can see is to somehow apply the alpha gradiant to the crawl itself -- fade it in and out at the edges. But I have no idea how you'd do that for something like this. Putting the gradiant on the Canvas seems quite pointless, and if it were on the Label, it would need to slide along the Label from left to right at precisely the same speed the Label is moving across the Canvas from right to left.

Is there some solution I'm missing, or should I toss this in the More Trouble Than It's Worth pile?

You could try adding a fade effect in parallel.