File: example/set.php

Recommend this page to a friend!
  Classes of Edgar Asatryan  >  PHP SVG Magick Library  >  example/set.php  >  Download  
File: example/set.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP SVG Magick Library
Compose vectorial graphics in SVG format
Author: By
Last change:
Date: 3 years ago
Size: 933 bytes
 

 

Contents

Class file image Download
<?php
use nstdio\svg\animation\AnimateTransform;
use
nstdio\svg\animation\Set;
use
nstdio\svg\container\SVG;

require_once
__DIR__ . '/../vendor/autoload.php';

$svg = new SVG(500, 350);

$rect = new \nstdio\svg\shape\Rect($svg, 50, 50, 255, 125);
$rect->id = "deepPink-rectangle";
$rect->fill = "deepPink";
$rect->transform = "rotate(0) translate(0 0)";

$svg->append($rect);

$transform = new AnimateTransform($rect);
$transform->attributeName = "transform";
$transform->attributeType = "XML";
$transform->type = "rotate";
$transform->from = "0 250 150";
$transform->to = "360 250 150";
$transform->dur = "2s";
$transform->begin = "0s";
$transform->fill = "freeze";
$transform->repeatCount = "indefinite";
$transform->restart="whenNotActive";

$rect->animate($transform);

$set = new Set($svg);
$set->attributeName = "fill";
$set->to = "#0099AA";
$set->begin = "click";
$set->dur = "3s";

$rect->animate($set);

echo
$svg->draw();


For more information send a message to info at phpclasses dot org.