PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Michael Feinbier   Create Gradient   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example file for creating a gradient
Class: Create Gradient
creates gradient from two colors
Author: By
Last change:
Date: 20 years ago
Size: 818 bytes
 

Contents

Class file image Download
<h2>Gradient Class Example</h2>
Author: Michael Feinbier &lt;mf@tiberianmaster.net&gt;<p>
<?php
/* GRADIENT CLASS EXAMPLE */
require "class.gradient.php";

$fade_from = "#FF0000"; // HEX-Color to fade from
$fade_to = "#0000FF"; // HEX-Color to fade to
$steps = 15; // number of steps creating the gradient

$gradient = new gradient($fade_from,$fade_to,$steps); // define the class

echo "Gradient from <b>".$gradient->color1."</b> to <b>".$gradient->color2."</b></p><pre>";

print_r($gradient->createArray()); // outputs the array to see the values

echo "</pre><table width='300' border='0'>"; // creates the table with colors
 
foreach($gradient->createArray() AS $color){
      echo
"<tr><td bgcolor=$color>&nbsp;</td><td>$color</td></tr>";
    };
  echo
"</table>";
?>