/
Animation.php
executable file
·57 lines (51 loc) · 1.33 KB
/
Animation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php namespace Khill\Lavacharts\Traits;
use Khill\Lavacharts\Utils;
trait Animation
{
/**
* Animation Easing
*
* The easing function applied to the animation. The following options are available:
* 'linear' - Constant speed.
* 'in' - Ease in - Start slow and speed up.
* 'out' - Ease out - Start fast and slow down.
* 'inAndOut' - Ease in and out - Start slow, speed up, then slow down.
*
* @param string $easing
*
* @return Chart
*/
public function animationEasing($easing = 'linear')
{
$values = array(
'linear',
'in',
'out',
'inAndOut'
);
if (in_array($easing, $values)) {
$this->easing = $easing;
} else {
$this->error('Invalid animationEasing value, must be (string) '.Utils::arrayToPipedString($values));
}
return $this;
}
/**
* Animation Duration
*
* The duration of the animation, in milliseconds.
*
* @param mixed $duration
*
* @return Chart
*/
public function animationDuration($duration)
{
if (is_int($duration) || is_string($duration)) {
$this->duration = $this->_valid_int($duration);
} else {
$this->duration = 0;
}
return $this;
}
}