animate light to dark
scott at tactilemedia.com
Tue Sep 13 21:57:06 CDT 2005
Recently, Michael J. Lew wrote:
> I am trying to get a smooth animation of a background going from
> light to dark (and vice versa), but I'm having trouble making it fast
> enough, smooth enough and flicker-free.
> What I need is to have a large dark region behind some images get
> light over about half a second so that the transition doesn't look
> too amateurish. I also need to be able to respond to messages while
> the change in darkness is occurring.
This last line is a significant hurdle. Being able to respond to messages
means you can't use any of the built-in transitions. So you are correct to
attempt to build the transition yourself.
> I've tried playing with fill
> colors of buttons and fields and with blendlevels of an image. I also
> tried the straightforward approach of simply stacking a sequence of
> buttons with different fill colors and hiding or showing them in
> sequence. For every approach I've tried the transitions are good
> enough with small areas, but when the objects are made large enough
> for my purposes they are slow and yukky.
Doing visual changes over large areas does indeed require more
overhead/resources, as will accounting for a lot of controls. As far as
what you describe above goes, here are some more efficient options:
1) use a large image set to solid black (or whatever color is appropriate),
and set its blendLevel repeatedly from 100 to 0 and then back to 100 again.
put "" into fCount
set blendLevel of img myFader to 100
if fCount = "" then put 1 into fCount
set the blendLevel of img myFader to abs(100 - (fCount * 5))
# ADD YOUR ROUTINES HERE
if fCount < 40 then
add 1 to fCount
initFader # MAKE CERTAIN MYFADER IS NOT VISIBLE
send "fadeCard" to me in 10 millisecs
2) use a button (with all visible properties disabled) as an image display
and set its icon repeatedly to a sequence of images as above (solid color
images will be the most efficient)
3) depending on what's happening on your card, you might be able to
repeatedly set the backColor of the card from light to dark and light (as
above) but obviously this will not obscure any controls on the card
4) you might consider giving up the fade transition all together and instead
simply lock the screen while popping up a separate "activity" window that
displays an animation to draw users' attention away from the updating window
Hope this helps.
Tactile Media, Multimedia & Design
E: scott at tactilemedia.com
More information about the use-livecode