-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch.js
76 lines (58 loc) · 1.15 KB
/
sketch.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
let foguetes = [];
let num_foguetes = 1;
let dt = 1;
let hu;
/*
let whistle;
let crack;
function preload() {
soundFormats('w1 whistle = loadSound('whistle');
crack = loadSound('crack');
}
*/
function setup() {
createCanvas(600, 400);
hu = random(0,255);
}
function draw() {
push();
colorMode(HSB);
textSize(25);
hu += random(5,10);
if (hu >= 250 )
{ hu = 0 }
stroke(hu, 255, 255);
strokeWeight(3)
fill(255);
text('Feliz Natal e', 10, 35);
text('Próspero 2022', 10, 65);
pop();
colorMode(RGB);
background(0,25);
textSize(10);
noStroke();
fill(255);
text('b e t t o a l s u r', width - 80, height-10);
if (random() < 0.05)
{
for (let i = 0 ; i < num_foguetes ; i++)
{
foguetes.push( new foguete() );
// whistle.play();
}
}
for (let foguete of foguetes)
{
let gravity = createVector(0,0.5)
foguete.addForce(gravity);
foguete.update(dt);
foguete.show();
}
for (let i = foguetes.length - 1 ; i >= 0 ; i--)
{
if ( !foguetes[i].exist )
{
foguetes.splice(i,1);
}
}
}