-
Notifications
You must be signed in to change notification settings - Fork 0
/
Terre.js
82 lines (63 loc) · 1.9 KB
/
Terre.js
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//declaration de tout les Actors
var etoiles = new Actor("etoiles");
var etoile = new Actor("etoile");
var boot = new Actor("bootlogo");
var terre = new Actor("terre");
var terre_nuage = new Actor("terre_nuage");
var lune = new Actor("lune");
var soyouz = new Actor("soyouz");
//propriété etoiles et etoiles filante
etoiles.rotation = <50, 50, 50>;
lune.position->y = 2;
soyouz.position->x = 7;
var rnd_startX = 0;
var rnd_endX = 0;
var rnd_starty = 0;
var rnd_endY = 0;
var rnd_start = 0;
var rnd_end = 0;
var rnd_dg = 0;
//propriété bootlogo
var hide = <0.9, 0.0, 0.9, 1.0>;
var show = <0.1, 0.0, 0.1, 1.0>;
boot.color = <1.0, 1.0, 1.0, 1.0>;
//fonctions
function random()
{
rnd_dg = Math.floor((Math.random() * 2) -1);
rnd_startX = Math.floor((Math.random() * 101) + 200);
rnd_endX = Math.floor((Math.random() * 101) + 200);
rnd_starty = Math.floor((Math.random() * 401) - 200);
rnd_endY = Math.floor((Math.random() * 401) - 200);
rnd_start = <rnd_dg * rnd_startX, rnd_startY, -200>;
rnd_end = <-rnd_dg * rnd_endX, rnd_endY, -200>;
}
random();
etoile.position = rnd_start;
function etoileFilante()
{
if(etoile.position->x != rnd_end->x && etoile.position->y != rnd_end->y)
{
etoile.setPosition(rnd_end, 4.0, INTERPOLATION_LINEAR);
}
else if(etoile.position->x == rnd_end->x && etoile.position->y == rnd_end->y)
{
random();
etoile.position = rnd_start;
}
};
function planetes()
{
terre.rotation->y += 0.001;
terre_nuage.rotation->y += 0.001;
lune.rotation->y -= 0.002;
soyouz.rotation->y += 0.001;
};
function bootlogo()
{
boot.setColor( <0.0, 0.0, 0.0, 0.0>, 2.0, INTERPOLATION_BEZIER, hide );
};
//timers
System.timer[0] = new IntervalTimer(0.01, planetes);
System.timer[0] = new IntervalTimer(5.0, etoileFilante);
System.timer[0] = new IntervalTimer(3.0, bootlogo);