This is an slow(give it a set_time_limit(10)) and dirty animated matrix ever changing data grid effect:

You have to have the GIFEncoder class and GD library in order to use make this effect work
include('GIFEncoder.class.php'); $max_x = 468; $max_y = 60; $step = 10; $font_file = 'cour.ttf'; $font_size = 10; $color = pow(255,2); $frames = 10; //repeating frame //first generate enough lines $measuer = imagettfbbox(10,0,'cour.ttf','1'); $line_height = $measuer[1] - $measuer[7]; //measuer how many lines $max_line = $max_y/$line_height; $i = 0; //Create a list of string while($i<$frames){ $n = 0; while($n<$max_line){ $a = imagettfbbox($font_size, 0, $font_file, $tmp); if($a[2] - $a[0]>$max_x){ $text[$i] .= $tmp."\n"; ++$n; $tmp = ''; }else{ $tmp .= chr(rand(65,90)); } } ++$i; } ob_start(); $i = 0; while($i<$frames){ $image = imagecreatetruecolor($max_x, $max_y); imagettftext($image,$font_size,0,0,$line_height,$color,$font_file,$text[$i]); imagegif($image); $imagedata[$i] = ob_get_contents(); ob_clean(); ++$i; } //gifmerge $gif = new GIFEncoder( $imagedata, 100, 0, 2, 0, 0, 0, "bin" ); header ( 'Content-type:image/gif' ); echo $gif->GetAnimation ();
Comments
Post new comment