Light::intensity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 6, 2016 - 8:47:40 PM
5
 * Contact      [email protected]
6
 * @copyright   2016 Marko Kungla - https://github.com/mkungla
7
 * @license     The MIT License (MIT)
8
 * 
9
 * @category       AframeVR
10
 * @package        aframe-php
11
 * 
12
 * Lang         PHP (php version >= 7)
13
 * Encoding     UTF-8
14
 * File         Light.php
15
 * Code format  PSR-2 and 12
16
 * @link        https://github.com/mkungla/aframe-php
17
 * @issues      https://github.com/mkungla/aframe-php/issues
18
 * ********************************************************************
19
 * Contributors:
20
 * @author Marko Kungla <[email protected]>
21
 * ********************************************************************
22
 * Comments:
23
 * @formatter:on */
24
namespace AframeVR\Extras\Primitives;
25
26
use \AframeVR\Core\Entity;
27
use \AframeVR\Interfaces\EntityInterface;
28
29
class Light extends Entity implements EntityInterface
30
{
31
32
    /**
33
     * Init <a-light>
34
     *
35
     * The light primitive adjusts the lighting setup of the scene. It is an entity that maps attributes to properties
36
     * of the light component.
37
     * 
38
     * @return void
39
     */
40 3
    public function reset()
41
    {
42 3
        parent::reset();
43 3
        $this->attr('Light');
44
        
45 3
    }
46
47
    /**
48
     * light.angle
49
     *
50
     * @param int|float $angle            
51
     * @return self
52
     */
53 2
    public function angle(float $angle = 60)
54
    {
55 2
        $this->attr('Light')->angle($angle);
56 2
        return $this;
57
    }
58
59
    /**
60
     * light.color
61
     *
62
     * @param string $color            
63
     * @return self
64
     */
65 2
    public function color(string $color = '#fff'): EntityInterface
66
    {
67 2
        $this->attr('Light')->color($color);
68 2
        return $this;
69
    }
70
71
    /**
72
     * light.decay
73
     *
74
     * @param int $decay            
75
     * @return self
76
     */
77 2
    public function decay(int $decay = 1)
78
    {
79 2
        $this->attr('Light')->decay($decay);
80 2
        return $this;
81
    }
82
83
    /**
84
     * light.distance
85
     *
86
     * @param float $distance            
87
     * @return self
88
     */
89 2
    public function distance(float $distance = 0.0)
90
    {
91 2
        $this->attr('Light')->distance($distance);
92 2
        return $this;
93
    }
94
95
    /**
96
     * light.exponent
97
     *
98
     * @param float $exponent            
99
     * @return self
100
     */
101 2
    public function exponent(float $exponent = 10.0)
102
    {
103 2
        $this->attr('Light')->exponent($exponent);
104 2
        return $this;
105
    }
106
107
    /**
108
     * light.groundColor
109
     *
110
     * @param string $ground_color            
111
     * @return self
112
     */
113 2
    public function groundColor(string $ground_color = '#fff')
114
    {
115 2
        $this->attr('Light')->groundColor($ground_color);
116 2
        return $this;
117
    }
118
119
    /**
120
     * light.intensity
121
     *
122
     * @param float $intensity            
123
     * @return self
124
     */
125 2
    public function intensity(float $intensity = 1.0)
126
    {
127 2
        $this->attr('Light')->intensity($intensity);
128 2
        return $this;
129
    }
130
131
    /**
132
     * light.penumbra
133
     *
134
     * @param float $penumbra
135
     * @return self
136
     */
137 2
    public function penumbra(float $penumbra)
138
    {
139 2
        $this->attr('Light')->penumbra($penumbra);
140 2
        return $this;
141
    }
142
    
143
    
144
    /**
145
     * light.type
146
     *
147
     * @param string $type            
148
     * @return self
149
     */
150 2
    public function type(string $type = 'directional')
151
    {
152 2
        $this->attr('Light')->type($type);
153 2
        return $this;
154
    }
155
}
156