Функции для вывода градиентного текста по указанным цветам

                        
<?php
// ЛИСТАЕМ В САМЫЙ НИЗ
// by wapmast (profiwm)
// функция для проверки градиента
function plus_twain(&$hex1, &$hex2)
{
$hex1 = hexdec($hex1);
$hex2 = hexdec($hex2);
if ($hex1>$hex2) $hex1 = $hex1 - 5;
if ($hex1<$hex2) $hex1 = $hex1 + 5;
$hex1 = dechex($hex1);
$hex2 = dechex($hex2);
if (strlen($hex1)==1) $hex1 = "0".$hex1;
if (strlen($hex2)==1) $hex2 = "0".$hex2;
}

// функция цветного текста
function text2color($text,$color1,$color2){
$text = str_split($text);
$color1 = str_split($color1,2);
$color2 = str_split($color2,2);
for ($i=0;$i<count($text);$i++)
{
$text[$i] = "<span style='color: #$color1[0]$color1[1]$color1[2]'>$text[$i]</span>";
plus_twain($color1[0], $color2[0]);
plus_twain($color1[1], $color2[1]);
plus_twain($color1[2], $color2[2]);
}
return implode($text);
}

/*
FF0000 - красный
00FF00 - зеленый
0000FF - синий

string text2color(string $text, string $color1, string $color2)

$text - будущий цветной текст
$color1 - цвет 1 в hex
$color2 - цвет 2 в hex

*/

echo text2color("Hello World Hello World Hello World","FF0000","0000FF"); // не забудьте убрать вывод из скрипта функций когда будете копировать!
?>
0 23 0
0

Нет фото
wapmast * 0.01
• 24 дек 2017, 21:34


Ingush, какой скрипт?

0

Нет фото
Ingush * 0.19
• 21 апр 2016, 21:54


в какой файл ставить? все пробовал но не получаеться