PHP Classes

File: example/transform.php

Recommend this page to a friend!
  Classes of Edgar Asatryan   PHP SVG Magick Library   example/transform.php   Download  
File: example/transform.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: 7 years ago
Size: 720 bytes
 

Contents

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

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

$svg = new SVG(500, 150);

$rect = new \nstdio\svg\shape\Rect($svg, 50, 50, 50, 50);
$rect->id = "deepPink-rectangle";
$rect->fill = "deepPink";

$svg->append($rect);

$transform = new AnimateTransform($rect);
$transform->attributeName = "transform";
$transform->attributeType = "XML";
$transform->type = "rotate";
$transform->from = "0 75 75";
$transform->to = "360 75 75";
$transform->dur = "10s";
$transform->begin = "0s; 5s; 9s; 17s;";
$transform->end="2s; 8s; 15s; 25s;";
$transform->fill="freeze";
$transform->restart="whenNotActive";

$rect->animate($transform);

echo
$svg->draw();