
|
|
|
hannelsApplet (Version 1.1)
ChannelsApplet
is an applet and a canvas class that can be used to program animated
transformations of the red, blue, and green channels of a GIF or JPEG image. In
addition, the applet can perform vertical and horizontal sine wave distortions
on all image channels simultaneously.
A URL (and optionally, a URL target) can also be set for the applet. When the applet area is clicked, the specified
URL will loaded in the (optional) designated target.
|
|
 |
peration
The following documentation describes how the
ChannelsApplet class is used. You can also use the ChannelControl
canvas class if you wish to integrate channel animation in your own application
or applet. The ChannelControl class is
documented separately.
During
initialization, ChannelsApplet loads the GIF or JPEG image that will be
animated, and an (optional) transparent GIF file that is overlaid after each
frame of the animation has been rendered.
In order to animate
individual channels of an image, the applet requires you to write an set of
animation instructions, hereafter referred to as a program. The
animation program can be included in the HTML as a parameters of the APPLET tag,
or it can be placed in a text file on the server (i.e., the location from which
the Java code is loaded).
Note that it is possible to place an
animation program in both locations. In the event that the animation program
file cannot be loaded, then the animation program in the HTML will be used.
Instructions for creating the animation program as a file will be discussed
first, then the procedure for adapting the program to HTML will be described.
Each line of text in the animation program file represents the transformation
instructions that should be carried out for a single frame of animation. There
are seven different commands available: move red channel (MR), move green
channel (MG), move blue channel (MB), move all channels (MA), horizontal wave
(H), vertical wave (V), and reset image (R). Each command is detailed below.
CHANNEL MOVE COMMANDS
MR
(Move Red), MG (Move Green), MB (Move Blue), MA (Move All Channels)
Format:
[MR | MG | MB | MA] [X Delta (-999 to +999)] [Y Delta (-999 to +999)]
Example:
"MB-010-010 MG+010+010 MR-010+010 MA+000+010"
Explanation:
For this frame, a) Move blue channel up 10 and left 10, then b) Move green
channel down 10 and right 10, then c) Move red channel up 10 and right 10, then
d) Move all channels down 10.
NOTE: The X and Y offsets
are always from the position of the original image, NOT from the
position of the image in the preceding frame!
IMAGE
RESET COMMAND
Format: [R] [Percent (000 -
100)]
Example: "MA+50-35 R050"
Explanation:
For this frame, a) Move all channels (i.e., move image) down 50 and left 35,
then b) Reset image for next frame's transformation to 50% of this frame after
transformation and 50% of original image.
NOTE: R100
would reset the image for the next frame to the original image. This is the
default behavior if no reset command is specified, so R100 would be redundant.
Also, remember that the Reset command ONLY EFFECTS THE NEXT FRAME, not the
current frame.
IMAGE WAVE COMMANDS
V
(Vertical Wave), H (Horizontal Wave)
Format: [V | H]
[Number of Waves (1 - 9)] [Percent (000 - 100)] [Offset Degrees (000 - 360)]
Example: "MG+010-010 V1004000 H1002000 R080"
Explanation:
For this frame, a) Move green channel down 10 and left 10, then b) Perform a
vertical wave transformation on the image with one sine wave having a maximum
modulation of 4% of the image height and with the waveform beginning at an
offset of 0 degrees, then c) Perform a horizontal wave transformation on the
image with one sine wave having a maximum modulation of 2% of the image height
and with the waveform beginning at an offset of 0 degrees, then d) Reset image
for next frame's transformation to 20% of this frame after transformation and
80% of original image.
|
In addition to these standard commands,
ChannelsApplet supports one special command. If you wish to repeat a
frame without applying any transformations, you may enter the command STATIC
on a single line. This will cause the previously rendered frame to be repeated
in the animation sequence.
The last line in the animation program file
should be a line with the instruction END on it. This instruction tells
ChannelsApplet to stop reading the file for animation instructions. The
END instruction is not necessary if the animation program is in the
HTML.
To place the animation program within the APPLET tag in the HTML,
a frames parameter must be specified that contains the total number of
frames to be generated for the animation. A series of frameNN parameters
must also be specified, each of which contains the animation instructions for
the particular frame.
For example, if there are instructions for three
frames of animation, then the parameters would look like:
<PARAM NAME="frames" VALUE="3">
<PARAM NAME="frame1"
VALUE="V1004005 H1002000 MG-005+005">
<PARAM NAME="frame2"
VALUE="V1004000 H1002005 MG-005+010">
<PARAM NAME="frame3"
VALUE="MG+005-005 V1004000">
|
|
| |
 |
ample
|
|
|
If your browser
supports Java, you should see a demonstration of the ChannelsApplet to
the left of this text.
You can
view the
program instructions that produced this animation. | |
|
 |
arameters
Following are the HTML parameters for the applet.
A parameter marked "Opt" is optional, and a parameter marked "Req"
is required.
| Req |
image |
The file name of the GIF or JPEG image that is to be
animated.
The file path is based starting with the directory in which
the Java applet is located. |
| Opt |
mask |
The file name of a transparent GIF (GIF89a
format) image that will be drawn on top of each rendered frame. (The animated
image is overlaid with the non-animated mask image.)
The
file path is based starting with the directory in which the Java applet is
located. |
| Opt |
initWithImage |
If set to "true", then the applet
will draw the original image and then the mask overlay (if
specified) before the frame rendering process begins. This prevents having a
blank "hole" while the rendering process is executing.
If set
to "false", then only a progress bar at the bottom of the
applet will be displayed.
If this parameter is not specified, then the
parameter value defaults to "false". |
| Opt |
frameDelay |
The number of milliseconds to delay between each
frame of animation |
| Opt |
loopDelay |
The number of milliseconds to delay between each
animation loop. |
| Opt |
direction |
The sequence in which the frames of animation are
displayed.
If set to "forward", then the animation is
displayed beginning with frame one, and ending with the last frame.
If
set to "backward", then the animation is displayed beginning
with the last frame, and ending with the first frame.
If set to "yoyo",
then the animation is alternated between "forward" and "backward".
If
this parameter is not specified, then the parameter value defaults to "yoyo".
|
| Opt |
background |
The background color used during the rendering
process.
The color specified for this parameter can have a substantial
affect on a rendered frame.
The value must be a hexadecimal RGB value.
If instance "FF0000" would be red, and "888888" would be a
medium gray.
The color defaults to black if not specified. |
| Opt |
networkFile |
The file name of the text file that contains the
animation program (i.e., the rendering instructions for each frame of
animation).
If the file cannot be opened, then the applet will try to
use the animation instructions defined in the frameNN parameters
(see below), if they have been specified.
The file must
reside in the same directory as the Java applet. |
| Opt |
frames |
The number of frames of animation to be rendered.
There must be one frameNN parameter (see below) for each
animation frame.
This parameter is read only if the networkFile
parameter is not specified, or if the applet cannot open the specified networkFile. |
| Opt |
frameNN |
The rendering instructions for each frame of
animation.
There must be one frameNN parameter for each
frame of animation as specified in the frames parameter (see above). For
example, if the frames parameter is set to 3, then there must be a frame1,
frame2, and frame3 parameter.
See the Operation
section of this documentation above for information regarding the format of the
rendering instructions. |
| Opt |
appletBG |
This parameter is used to set the applet's background color.
The applet background color can sometimes be seen during a screen refresh when the page that contains the
applet is scrolled or resized
(do not confuse the applet background color with the
background color used for the animation).
The appletBG parameter has
been provided to allow you to set the applet background color so that the applet refresh is not as
noticeable when the page that contains the applet is scrolled or resized.
If a value for this parameter is specified, then the value must be a hexadecimal RGB value.
For instance "FF0000" would result in a red applet background,
and "888888" would result in a medium gray applet background (visible only during a screen refresh).
If this parameter is not specified, then the applet background color will default to the browser background color.
|
| Opt |
url |
This parameter specifies a URL to load when the mouse is clicked within the applet area.
|
| Opt |
target |
This parameter specifies an optional target for the url parameter.
|
|
|
 |
xample
An example of a HTML APPLET tag with all
parameters for this applet is shown below. Note that image and
mask images should be the same size, and that the image dimensions are
used for the applet width and height parameters.
<APPLET CODE="ChannelsApplet.class"
WIDTH="97" HEIGHT="172">
<PARAM NAME="appletBG" VALUE="7D3B9D">
<PARAM NAME="image"
VALUE="AnimatedImage.JPG">
<PARAM NAME="mask"
VALUE="MaskImage.GIF"> <PARAM NAME="initWithImage"
VALUE="true"> <PARAM NAME="frameDelay" VALUE="80"> <PARAM
NAME="loopDelay" VALUE="100"> <PARAM NAME="direction"
VALUE="forward"> <PARAM NAME="background" VALUE="FF0000"> <PARAM
NAME="networkFile" VALUE="AnimProgram.txt"> <PARAM
NAME="frames" VALUE="1">
<PARAM NAME="frame1" VALUE="static">
<PARAM NAME="url" VALUE="http://www.modernminds.com">
<PARAM NAME="target" VALUE="_blank">
</APPLET>
|
|
|
 |
ownload
The applet ChannelsApplet,
along with a copy of this documentation,
is available for download
as a standard zip file, as a self-extracting file (for Windows95/NT users), or as a
self-installing Java class file.
|
|
 |
opyright
This documentation and the object code for ChannelsApplet
and ChannelControl may be copied and distributed freely for
non-commercial purposes so long as neither the code nor the documentation is
altered in any way. If the object code is distributed with any documentation
whatsoever, then this unaltered document must accompany the code.
Copyright © 1997, 1998 by Modern Minds, Inc.
|