Вход Регистрация
* Pelmeshka

Анимационный текст (GIF)

  1. <?php
  2.  
  3.  
  4.  
  5. $animation = new Imagick();
  6.  
  7.  
  8.  
  9. $animation->setFormat('gif');
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. $color = new ImagickPixel('white');
  18.  
  19.  
  20.  
  21. $color->setColor('white');
  22.  
  23.  
  24.  
  25. $string = 'masteram.us';
  26.  
  27.  
  28.  
  29. $draw = new ImagickDraw();
  30.  
  31.  
  32.  
  33. //$draw->setFont('Arial');
  34.  
  35.  
  36.  
  37. for ($i = 0; $i <= strlen($string); $i++)
  38.  
  39.  
  40.  
  41. {
  42.  
  43.  
  44.  
  45. $part = substr($string, 0, $i);
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. $animation->newImage(100, 40, $color);
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. $animation->annotateImage($draw, 10, 20, 0, $part);
  62.  
  63.  
  64.  
  65. $animation->setImageDelay(30);
  66.  
  67.  
  68.  
  69. }
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. //$draw->setFont('Arial-Bold');
  78.  
  79.  
  80.  
  81. $draw->setTextDecoration(imagick::DECORATION_UNDERLINE);
  82.  
  83.  
  84.  
  85. $animation->newImage(100, 40, $color);
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. $animation->annotateImage($draw, 10, 20, 0, $string);
  94.  
  95.  
  96.  
  97. $animation->setImageDelay(70);
  98.  
  99.  
  100.  
  101. header('Content-Type: image/gif');
  102.  
  103.  
  104.  
  105. echo $animation->getImagesBlob();
  106.  
  107.  
  108.  
  109. ?>
» Описание: Создастся анимация с текстом masteram.us. Требуется библиотека Image Magick. Пропишите свою ссылку.
» Время добавления: 12 Дек 2014 в 23:13
» Посмотров: 1556
» textarea
» Рейтинг: [+0 | -0]
Комментарии [0]
Онлайн: 1
Реклама