1
|
|
|
<?php |
2
|
|
|
namespace nstdio\svg\animation; |
3
|
|
|
|
4
|
|
|
use nstdio\svg\attributes\AnimationAddition; |
5
|
|
|
use nstdio\svg\attributes\AnimationEvent; |
6
|
|
|
use nstdio\svg\attributes\AnimationTiming; |
7
|
|
|
use nstdio\svg\attributes\AnimationValue; |
8
|
|
|
use nstdio\svg\attributes\ConditionalProcessing; |
9
|
|
|
use nstdio\svg\attributes\ExternalResourcesRequired; |
10
|
|
|
use nstdio\svg\attributes\XLink; |
11
|
|
|
use nstdio\svg\ElementInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class AnimateMotion |
15
|
|
|
* The animateMotion element causes a referenced element to move along a motion path. |
16
|
|
|
* |
17
|
|
|
* @link https://www.w3.org/TR/SVG11/animate.html#AnimateMotionElement |
18
|
|
|
* @property string calcMode = discrete | linear | paced | spline. Specifies the interpolation mode for the animation. |
19
|
|
|
* Refer to general description of the |
20
|
|
|
* 'calcMode' attribute above. The only difference is that the default value for the 'calcMode' for |
21
|
|
|
* 'animateMotion' is 'paced'. |
22
|
|
|
* @property string path The motion path, expressed in the same format and interpreted the same way as the 'd' |
23
|
|
|
* attribute on the 'path' element. The effect of a motion path animation is to add a supplemental |
24
|
|
|
* transformation matrix onto the CTM for the referenced object which causes a translation along the x- and |
25
|
|
|
* y-axes of the current user coordinate system by the computed X and Y values computed over time. |
26
|
|
|
* @property string keyPoints 'keyPoints' takes a semicolon-separated list of floating point values between 0 and 1 and |
27
|
|
|
* indicates how far along the motion path the object shall move at the moment in time specified by |
28
|
|
|
* corresponding 'keyTimes' value. Distance calculations use the user agent's distance along the path |
29
|
|
|
* algorithm. Each progress value in the list corresponds to a value in the 'keyTimes' attribute list. |
30
|
|
|
* @property string rotate = "<number> | auto | auto-reverse". The 'rotate' attribute post-multiplies a supplemental |
31
|
|
|
* transformation matrix onto the CTM of the target element to apply a rotation transformation about the |
32
|
|
|
* origin of the current user coordinate system. The rotation transformation is applied after the |
33
|
|
|
* supplemental translation transformation that is computed due to the 'path' attribute. |
34
|
|
|
* @property string origin "default" The 'origin' attribute has no effect in SVG. |
35
|
|
|
* |
36
|
|
|
* @package nstdio\svg\animation |
37
|
|
|
* @author Edgar Asatryan <[email protected]> |
38
|
|
|
*/ |
39
|
|
|
class AnimateMotion extends BaseAnimation implements ConditionalProcessing, AnimationEvent, AnimationValue, AnimationAddition, AnimationTiming, XLink, ExternalResourcesRequired |
40
|
|
|
{ |
41
|
|
|
/** |
42
|
|
|
* AnimateMotion constructor. |
43
|
|
|
* |
44
|
|
|
* @param ElementInterface $parent |
45
|
|
|
*/ |
46
|
2 |
|
public function __construct(ElementInterface $parent) |
47
|
|
|
{ |
48
|
2 |
|
parent::__construct($parent); |
49
|
|
|
|
50
|
2 |
|
$this->calcMode = 'paced'; |
51
|
2 |
|
$this->rotate = 0; |
52
|
2 |
|
} |
53
|
|
|
|
54
|
2 |
|
public function getName() |
55
|
|
|
{ |
56
|
2 |
|
return 'animateMotion'; |
57
|
|
|
} |
58
|
|
|
} |