Grads On The Fly Function
This tutorial is a supplement to the Grads on the fly written by Sally. It uses the same script to create functions that make the coding a bit easier, however, it also requires that your document be a php document and the code is written in php. You must have access to PHP on your server for this script to work.
I have written a page of functions and put them in a zip file OTFfunctions.php which you must place in the same directory as the OTF-Grad-Maker.php file from Sally's site. Using this file as an include on your page, it creates a shortcut for you when writing the OTF codes. For example, the codes:
<img src=OTF-Grad-Maker.php?d=h&h=50&r=n&s=0,0,0&e=30,144,255 width=100 height=50>
Become:
<?;
include('OTFfunctions.php');
roll(0, 0, 0, 30, 144, 255, 100, 50);
?>
Where roll is the type of function being called; the first 3 numbers are the start color; the second 3 numbers are the end color; followed by the width and height of the gradient.
The different functions available are as follows:
tube(10, 10, 10, 255, 55, 255, 50, 50);
vert(10, 10, 10, 255, 55, 255, 50, 50);
vert(255, 55, 255, 10, 10, 10, 50, 50);
horz(255, 55, 255, 10, 10, 10, 50, 50);
horz(10, 10, 10, 255, 55, 255, 50, 50);
roll(10, 10, 10, 255, 55, 255, 50, 50);
These codes produce the following images (and are included in the zip file).
If you familiar with php coding, you can use php loops to create a shortcut. Below are some examples of php loops using these functions.
then copy (Ctrl-C) & paste (Ctrl-V)
$width=1;
while ($width <= 90 ) {
$width = $width + 3;
echo "";
tube(100,0,100,255,0,255,$width, 1);
tube(100,0,100,255,0,255,$width, 1);
echo "
";
}
$width2=93;
while ($width2 > 3 ) {
$width2 = $width2 - 3;
echo "";
tube(100,0,100,255,0,255,$width2, 1);
tube(100,0,100,255,0,255,$width2, 1);
echo "
";
}
then copy (Ctrl-C) & paste (Ctrl-V)
$width=1;
while ($width <= 90 ) {
$width = $width + 3;
echo "";
tube(100,0,100,0,255,255,$width, 1);
echo "
";
}
$width2=93;
while ($width2 > 3 ) {
$width2 = $width2 - 3;
echo "";
tube(100,0,100,0,255,255,$width2, 1);
echo "
";
}
then copy (Ctrl-C) & paste (Ctrl-V)
echo "";
$count=6;
while($count > 0){
$count=$count-1;
horz(10, 10, 10, 255, 255, 255, 10, 10);
roll(10, 10, 10, 255, 255, 255, 20, 10);
horz(255, 255, 255, 10, 10, 10, 10, 10);
horz(10, 10, 10, 255, 255, 255, 10, 10);
roll(10, 10, 10, 255, 255, 255, 20, 10);
horz(255, 255, 255, 10, 10, 10, 10, 10);
horz(10, 10, 10, 255, 255, 255, 10, 10);
roll(10, 10, 10, 255, 255, 255, 20, 10);
horz(255, 255, 255, 10, 10, 10, 10, 10);
horz(10, 10, 10, 255, 255, 255, 10, 10);
roll(10, 10, 10, 255, 255, 255, 20, 10);
horz(255, 255, 255, 10, 10, 10, 10, 10);
echo " ";
}
then copy (Ctrl-C) & paste (Ctrl-V)
echo "";
echo "
";
$times=80;
$width=0;
while($width<=$times){
$width=$width+10;
echo "";
echo "";
horz(0, 0, 0, 255, 255, 255, $width, 8);
echo " ";
horz(0, 0, 0, 0x22, 0x22, 255, $width, 8);
echo " ";
horz(0x22, 0x22, 255, 0, 0, 0,$width, 8);
echo " ";
horz(255, 255, 255, 0, 0, 0, $width, 8);
echo " ";
}
echo "
";
echo "";
then copy (Ctrl-C) & paste (Ctrl-V)
";
horz(255, 255, 255, 0x66, 0x33, 0x33, $width, 4);
echo " ";
horz(255, 255, 255, 0x66, 0x33, 0x33, $width, 4);
echo " ";
horz(0x66, 0x33, 0x33, 255, 255, 255, $width, 4);
echo " ";
horz(0x66, 0x33, 0x33, 255, 255, 255, $width, 4);
echo "
";
}
?>
=$count){
$width2=$width2-5;
echo "";
horz(255, 255, 255, 0x66, 0x33, 0x33, $width2, 4);
echo " ";
horz(255, 255, 255, 0x66, 0x33, 0x33, $width2, 4);
echo " ";
horz(0x66, 0x33, 0x33, 255, 255, 255, $width2, 4);
echo " ";
horz(0x66, 0x33, 0x33, 255, 255, 255, $width2, 4);
echo "
";
}
?>
";
horz(255, 255, 255, 0x66, 0x33, 0x33, $width, 4);
echo " ";
horz(255, 255, 255, 0x66, 0x33, 0x33, $width, 4);
echo " ";
horz(0x66, 0x33, 0x33, 255, 255, 255, $width, 4);
echo " ";
horz(0x66, 0x33, 0x33, 255, 255, 255, $width, 4);
echo "
";
}
$count=0;
$width2=44;
while($width2>=$count){
$width2=$width2-5;
echo "";
horz(255, 255, 255, 0x66, 0x33, 0x33, $width2, 4);
echo " ";
horz(255, 255, 255, 0x66, 0x33, 0x33, $width2, 4);
echo " ";
horz(0x66, 0x33, 0x33, 255, 255, 255, $width2, 4);
echo " ";
horz(0x66, 0x33, 0x33, 255, 255, 255, $width2, 4);
echo "
";
}
?>