|
 |
SWFGradient (PHP 4 >= 4.0.5) SWFGradient -- Creates a gradient object DescriptionSWFGradient swfgradient ( void ) Внимание |
Эта функция является ЭКСПЕРИМЕНТАЛЬНОЙ.
Поведение этой функции, ее имя и относящаяся к ней документация
могут измениться в последующих версиях PHP без уведомления.
Используйте эту функцию на свой страх и риск. |
swfgradient() creates a new SWFGradient object.
After you've added the entries to your gradient, you can use the gradient
in a shape fill with the swfshape->addfill() method.
SWFGradient has the following methods : swfgradient->addentry().
This simple example will draw a big black-to-white gradient as background,
and a reddish disc in its center.
Пример 1. swfgradient() example
<?php
$m = new SWFMovie();
$m->setDimension(320, 240);
$s = new SWFShape();
$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(1.0, 0xff, 0xff, 0xff);
$f = $s->addFill($g, SWFFILL_LINEAR_GRADIENT);
$f->scaleTo(0.01);
$f->moveTo(160, 120);
$s->setRightFill($f);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$m->add($s);
$s = new SWFShape();
$g = new SWFGradient();
$g->addEntry(0.0, 0xff, 0, 0, 0xff);
$g->addEntry(1.0, 0xff, 0, 0, 0);
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.005);
$f->moveTo(160, 120);
$s->setRightFill($f);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$m->add($s);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
|
|
SWFGradient
mabuzzer at hotmail dot com
13-Mar-2002 10:49
Gradient fills are implemented in SWF as a color ramp, mapped onto a square from (-16384, -16384) to (16384, 16384) TWIPS.
The following code creates a movie, displaying a square with a gradient fill, correctly scaled to the size of the shape.
<?php
ming_setscale(1.0);
$m = new SWFMovie();
$m->setRate(12.0);
$m->setDimension(400,400);
$m->setBackground(0xff, 0xff, 0xff);
$sx = 300;
$sy = 300;
$s = new SWFShape();
$g = new SWFGradient();
$g->addEntry(0.0, 0x00, 0x00, 0xff); $g->addEntry(1.0, 0xff, 0xff, 0x00); $f = $s->addFill($g);
$f->moveTo($sx/2, $sy/2);
$f->scaleTo($sx/32768, 1);
$s->setRightFill($f);
$s->drawLine($sx, 0);
$s->drawLine(0, $sy);
$s->drawLine(-$sx, 0);
$s->drawLine(0, -$sy);
$sh = $m->add($s);
$sh->moveTo(50, 50);
header("Content-type: application/x-shockwave-flash");
$m->output();
?>
More info about this can be obtained from
http://www.openswf.org/spec/SWFfilereference.html#h4FillTypes
| |