+-------------------------------------+
|T h e C h e s h i r e E f f e c t|
++-----------------------------------++
| ragnar_fyri@hotmail.com |
+-----------------------------------+
Inspiration does not necessarily travel in straight lines. One day a
couple of years back I was humming a theme from "Hair" when I started thin-
king about some of the shorter songs, particularly "I'm black". For those
who haven't heard any of the songs from the musical or don't remember the
words, this little track consists of different voices singing something
like "I'm black, I'm black / I'm pink, I'm pink / I'm (something) white /
I'm invisible!" [and that's the whole song...] Somehow I got the idea to
make an animation (or rather persuade someone who draws better than I do,
to make one) in which the song is performed by four different animals
(selected for fur/skin colour). The last one, I decided, would have to be a
Cheshire Cat [from "Through the Looking Glass" in case you didn't know that
either!] which fades into the background while it's singing.
The animation hasn't been made yet (I haven't even suggested it to any-
one) but I started thinking about how the effect can be done on an Amiga.
Fading a figure into a monochrome background would be easy - just make sure
the cat and the background don't share any colours in the palette, then
fade the colours used in the cat image into the colour used for the
background. But, I decided, it would look even more impressive if the cat
fades in and out over a multicoloured background!
The enclosed program and picture does just that. Or rather, the program
does it with the picture. It starts with loading the picture as it is. (You
can load it into Deluxe Paint or some other drawing program and you won't
see any cat, but try to modify the palette! [see below]) Press a key, and
the cat fades in. Another keypress, and the cat fades back out. A third
keypress exits the program after you have looked around and satisfied
yourself that the cat has become completely invisible again.
If all you want to do is enjoy a nice effect that could definitely use
some better graphics, you can stop reading here because I'm starting to go
into details now. How is it done? Well, if you load the picture into a
drawing program or something you will notice that it contains a palette of
32 colours, but only some of them seem to be used. More precisely, the
palette starts with six different colours, then the last five of them are
repeated five times each, and finally colour 31 is a lonesome yellow. The
25 colours in the five wide bands are the ones used for drawing the cat.
When these colours are set (in groups of five) similar to the first five
(not counting the blue colour 0 which is only used for the sky), whatever
is drawn on the background becomes invisible as long as the colour values
are selected according to the background. For example, colours 1 and 6 are
both black, so a line of colour 6 on a background of colour 1 will be
invisible until one of the colours is modified. The cat and the background
were drawn separately with five colours each, and then I wrote a special
program to "overlay" the cat on the background by translating pixel by
pixel into a special code. Colour 6 is actually the code for "cat colour 1
overlaid on background colour 1", 6 is the code for cat 2 on back 1 etc.
etc. If you're feeling adventurous you may try to make the cat appear
"manually" by loading the picture into Deluxe Paint or something and then
changing colours 6-10 to the following values (in hex): 000 E00 EEE 700 D80
- then copy this range into the next four five-colour ranges (colour 6 to
colour 11, colour 7 to colour 12 and so on). If you've done it right the
picture should now look exactly like the picture shown by the program a few
seconds after the first keypress.
So now what? I've got a mental image (that will never reach the screen
without outside help) of an animation in which a cat fades in and out as it
walks across the screen, interacting with the background as it moves. It's
not as hard as it may sound - I have already got a program to merge two
pictures, so "all" that needs to be done is to make two animations - one of
the background and one of the cat, and when I've got both (in standard ANIM
format) I'll just save them as single frames and feed them through the
program two by two to create the final animation. All YOU (assuming you
accept the challenge) have to do is think in two layers...
With old Amigas there is of course a limitation in only being able to use
five colours for each layer for a total of ten (plus two - the first and
the last in the case of this test/demo - that can only be used outside the
area the cat passes through), and it has probably occured to you that an
AGA machine should be able to use a lot more colours (The general rule is
that the number of colours that can be used is roughly the square root of
the total number of availble colours rounded down and multiplied by two).
Well, there are two problems with that: One, I only have (at the time of
writing this anyway) a 500+ with ECS, and I can only program in AMOS which
only supports the old resolutions. An AGA animation as described above
would take the project completely out of my hands and probably away from my
eyes as well... Sic transit gloria mundi! (?) [It may be possible to make a
256 colour animation and convert it to HAM, but I don't know...]
Of course the "walking cat with fade" animation would "only" be an inter-
mediate stage on the way to the musical animation I described in the
beginning... (And only the part with the Cheshire cat would have to use the
limited palette, so the other parts could have a lot more. Assuming an ani-
mation program is used that allows changing the palette for each frame,
that is...)
|