Completed
Push — master ( e8b22d...bec3f6 )
by Marko
11s
created

Cursor::reset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 18
ccs 14
cts 14
cp 1
rs 9.4285
cc 1
eloc 13
nc 1
nop 0
crap 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 7, 2016 - 10:51:16 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         Cursor.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
final class Cursor extends Entity implements EntityInterface
30
{
31
32
    /**
33
     * <a-cursor>
34
     *
35
     * The cursor primitive places a reticle or crosshair to add clicking and interactivity with the scene. It is an
36
     * entity that prescribes the cursor component and a default ring-shaped geometry. The cursor is usually placed as
37
     * a child of the camera.
38
     * 
39
     * @return void
40
     */
41 2
    public function reset()
42
    {
43 2
        parent::reset();
44 2
        $this->component('Geometry')->primitive('ring');
45 2
        $this->component('Geometry')->radiusOuter(0.016);
46 2
        $this->component('Geometry')->radiusInner(0.01);
47 2
        $this->component('Geometry')->segmentsTheta(64);
48
        
49 2
        $this->component('Material')->shader('flat');
50 2
        $this->color('#000');
51 2
        $this->component('Material')->opacity(0.8);
52
        
53 2
        $this->position(0, 0, - 1);
54
        
55 2
        $this->component('Cursor')->fuse(true);
56 2
        $this->component('Raycaster')->far(1000);
57 2
        $this->component('Cursor')->fuseTimeout(1500);
58
    }
59
}