|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
6
|
|
|
|
|
7
|
|
|
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\RepeatMode; |
|
8
|
|
|
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\Value; |
|
9
|
|
|
|
|
10
|
|
|
class AnimateItemCommand extends AbstractStandardCommand |
|
11
|
|
|
{ |
|
12
|
|
|
public const TYPE = 'AnimateItem'; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @param string|null $componentId The ID of the component to animate |
|
16
|
|
|
* @param int|null $duration Duration of the animation in milliseconds |
|
17
|
|
|
* @param string|null $easing Easing function for the animation |
|
18
|
|
|
* @param int|null $repeatCount Number of times to repeat the animation |
|
19
|
|
|
* @param RepeatMode|null $repeatMode How to repeat the animation |
|
20
|
|
|
* @param Value|null $value The property and values to animate |
|
21
|
|
|
*/ |
|
22
|
5 |
|
public function __construct( |
|
23
|
|
|
public ?string $componentId = null, |
|
24
|
|
|
public ?int $duration = null, |
|
25
|
|
|
public ?string $easing = null, |
|
26
|
|
|
public ?int $repeatCount = null, |
|
27
|
|
|
public ?RepeatMode $repeatMode = null, |
|
28
|
|
|
public ?Value $value = null, |
|
29
|
|
|
) { |
|
30
|
5 |
|
parent::__construct(self::TYPE); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
3 |
|
public function jsonSerialize(): array |
|
34
|
|
|
{ |
|
35
|
3 |
|
$data = parent::jsonSerialize(); |
|
36
|
|
|
|
|
37
|
3 |
|
if ($this->componentId !== null) { |
|
38
|
2 |
|
$data['componentId'] = $this->componentId; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
3 |
|
if ($this->duration !== null) { |
|
42
|
2 |
|
$data['duration'] = $this->duration; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
3 |
|
if ($this->easing !== null) { |
|
46
|
1 |
|
$data['easing'] = $this->easing; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
3 |
|
if ($this->repeatCount !== null) { |
|
50
|
1 |
|
$data['repeatCount'] = $this->repeatCount; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
3 |
|
if ($this->repeatMode !== null) { |
|
54
|
1 |
|
$data['repeatMode'] = $this->repeatMode->value; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
3 |
|
if ($this->value !== null) { |
|
58
|
1 |
|
$data['value'] = $this->value; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
3 |
|
return $data; |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|