Функция градиента текста...

                        
function gradient($text, $hexfrom, $hexto){ 

$text = iconv('utf-8','windows-1251',$text);
$colorsteps = strlen($text);

$fromrgb['r'] = hexdec(substr($hexfrom, 0, 2));
$fromrgb['g'] = hexdec(substr($hexfrom, 2, 2));
$fromrgb['b'] = hexdec(substr($hexfrom, 4, 2));

$torgb['r'] = hexdec(substr($hexto, 0, 2));
$torgb['g'] = hexdec(substr($hexto, 2, 2));
$torgb['b'] = hexdec(substr($hexto, 4, 2));

$steprgb['r'] = ($fromrgb['r'] - $torgb['r']) / ($colorsteps - 1);
$steprgb['g'] = ($fromrgb['g'] - $torgb['g']) / ($colorsteps - 1);
$steprgb['b'] = ($fromrgb['b'] - $torgb['b']) / ($colorsteps - 1);

for($i = 0; $i <= $colorsteps; $i++){

$rgb['r'] = floor($fromrgb['r'] - ($steprgb['r'] * $i));
$rgb['g'] = floor($fromrgb['g'] - ($steprgb['g'] * $i));
$rgb['b'] = floor($fromrgb['b'] - ($steprgb['b'] * $i));

$hexrgb['r'] = sprintf('%02x', ($rgb['r']));
$hexrgb['g'] = sprintf('%02x', ($rgb['g']));
$hexrgb['b'] = sprintf('%02x', ($rgb['b']));

$color = implode(null, $hexrgb);

$return .= '<font color="'.$color.'">'.$text[$i].'</font>';

}

return iconv('windows-1251','utf-8',$return);
}
3 18 0
0

Нет фото
• 21 окт 2013, 19:32


Вытащи меня из чёрного списка