Приглашаем посетить
Просвещение (lit-prosv.niv.ru)

Animation

##############################################################################
# Animation                     Version 1.2                                  #
# Copyright 1996 Matt Wright    mattw@worldwidemart.com                      #
# Created 9/28/95               Last Modified 11/21/95                       #
# Scripts Archive at:           http://www.worldwidemart.com/scripts/        #
##############################################################################
# If you run into any problems while trying to configure this scripts, help
# is available.  The steps you should take to get the fastest results, are:
#	1) Read this file thoroughly
#	2) Consult the Matt's Script Archive Frequently Asked Questions:
#		http://www.worldwidemart.com/scripts/faq/
#	3) If you are still having difficulty installing this script, send
#	   e-mail to: scripts-help@tahoenet.com
#	   Include any error messages you are receiving and as much detail
#	   as you can so we can spot your problem.  Also include the variable
#	   configuration block that is located at the top of the script.
#
# Hopefully we will be able to help you solve your problems.  Thank you.
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1996 Matthew M. Wright  All Rights Reserved.                     #
#                                                                            #
# Animation may be used and modified free of charge by anyone so long as     #
# this copyright notice and the comments above remain intact.  By using this #
# code you agree to indemnify Matthew M. Wright from any liability that      #  
# might arise from it's use.                                                 #  
#                                                                            #
# Selling the code for this program without prior written consent is         #
# expressly forbidden.  In other words, please ask first before you try and  #
# make money off of my program.                                              #
#                                                                            #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium.	In all cases copyright and header must remain intact #
##############################################################################

This script allows you to implement animations in-lined into your HTML pages.  
It uses the idea of server push, where images are pushed down by the server to 
the client one after the other, which creates the look of an animation.  There 
is not much to this script and it should not be hard to install onto your 
system.  You will need to have Perl installed on your system and have access 
to execute CGI scripts either through a cgi-bin or a .cgi extension.  Check 
with your system administrator to see if they allows either of these.

There are two files included with this script:
        1) README - This file; includes detailed installation instructions.
        2) nph-anim.pl - The Perl script which generates the headers and 
                          pushes your images to the client.

The only file that needs to be edited for this script to work is the 
nph-anim.pl script.  Below is a set of instructions for setting it up 
on your system.

NPH-ANIM.PL -

        There are three variables that must be set in this script for it to 
work correctly:

$times = "1";

        This is the number of times you want the script to cycle through your 
entire animation.  Most of the time this will be set to "1", but you may wish 
for it to loop several times.

$basefile = "/path/to//images/008/";

        This is the base filename where all of your images are kept.  When the 
script chooses the images, the filenames from @files are appended to this to 
form a complete path to the image.  Realize that this path must be an absolute 
path on the system and should not be relative to the WWW pages.

@files = ("begin.gif","second.gif","third.gif","last.gif");

        These are the filenames, put into an array separated by commas, that 
will be appended to $basefile.  Put the images in the order that you want the 
animation sequence to run, with the first image as the first element of the 
array and the last image of the animation as your last element of the array.

$con_type = "gif";

	This should be set to the type of image you are planning on 
sending to the browser.  Values can be one of the following:
       VALUE		   IMAGE EXTENSION
	gif                      gif
	jpeg                     jpeg jpg jpe
	ief                      ief
	tiff                     tiff tif
	x-cmu-raster             ras
	x-portable-anymap        pnm
	x-portable-bitmap        pbm
	x-portable-graymap       pgm
	x-portable-pixmap        ppm
	x-rgb                    rgb
	x-xbitmap                xbm
	x-xpixmap                xpm
	x-xwindowdump            xwd

For instance, if you want to use a jpg image, you would put in 'jpeg' for 
this variable.  Use the values on the right in this variable, and you can 
identify the proper values by looking at the extension on your image and 
then looking for it in the right column and trace it over to the value in 
the left.  Keep in mind that not all of the values will display in all 
browsers.

_____________________________________________________________

Calling your animation from your HTML file.

Calling this animation script is as easy as in-lining an image.  If your 
animation script is located at the url:

http://your.host.xxx/cgi-bin/nph-anim.pl

Then you would call the animation simply by doing:

<img src="http://your.host.xxx/cgi-bin/nph-anim.pl">

Any other attribute to the image or animation can be added as normal, such as 
align, border, alt, etc... so that it would look like:

<img src="http://your.host.xxx/cgi-bin/nph-anim.pl" align=left border=0 
         alt="Animation!">
___________________________________________________________________________

FAQ:

Can I change the name of nph-anim.pl?  Why does it have nph- in front of it?

Good question.  If you change the name of the script from nph-anim.pl to 
something without nph- on the front of it, you will need to comment out 
the line:

print "HTTP/1.0 200 OK\n";

The nph- means non-parsed header file, which makes the server execute it 
instead of parsing the script.

You may also want to try commenting out the line if the script is giving 
you problems.
_________________________________________________________________________
HISTORY
   Version 1.0	- 9/18/95	- First Version Released
   Version 1.1  - 11/4/95	- Version 1.1 Released with a minor fix 
				  explaining the nph- and header outputs.
   Version 1.2  - 11/21/95	- A small fix, suggested by Robert Wood 
				  <wood@nexen.com> helped improve the 
				  buffering of the output of the images.
_________________________________________________________________________

This script is provided as is and comes with no warranties, expressed or 
implied.  It was written to be useful and fun, so by all means, enjoy it!  You 
have permission to edit/modify/whatever this script and I ask only two things 
in return:

1) If you implement it on a page, please let me know the URL of where it is 
   implemented so I can see my work

and

2) Please keep my name and url in the script itself somewhere, and if you 
would like you could even add it to your page, but that is not necessary.

If you have any questions, let me know and I will try and help!
____________________________________________________________________________
Matt Wright - mattw@worldwidemart.com  http://www.worldwidemart.com/scripts/