Animated Bubble Background
by Gary Rosenzweig
|
I know I've been writing a lot about Imaging Lingo recently. I use it a lot in my work, so it makes sense to write about it. The question is: is this what people want to read about? Use the "Discuss Article" button above to suggest topics for future columns. The topics have to be something that I can write about in a few pages, and they should be useful to many readers. This week I was asked by a client to make a unique background for a game's title page. It consisted of expanding circles of a single color filling the background, and then expanding circles of another color filling in over that, and so on. You can see this background in action right here:
A sample movie is available for download in Mac or PC format. I thought this was a pretty interesting effect, and I liked the idea of a background being animated rather than static. Also, this is a way of using Imaging Lingo that I hadn't thought of before. While this could have been done with sprites in previous versions of Director, in Director 8 this can be done with a simple behavior. Here is that behavior. It takes a list of colors, in this case only two, and switches between them. You could easily add more colors to the list. The behavior sits on a bitmap sprite and draws the circles over that bitmap. It will add a new circle at a random spot every 1/20th of a second until there are 20 circles. Each circle continues to expand until the first one is about 1/3 the screen width. This is roughly when the screen is full. Then the whole process starts over again with the next color in the list.
property pColor, pColorList
-- colors to use
-- make pointer to this sprite's image
-- start off with first color
-- start filling with second color
end
-- next color
-- start circle list fresh
-- add first circle
end
-- only allow 20 circles
-- start next circle in 50 ms
-- pick random spot for center
-- add circle to list
end
-- loop through circles and draw them
-- if first circle is greater than 1/3 the width of screen
end
-- add new circle if it is time
-- expand all circles
end
|