-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrograma
81 lines (73 loc) · 1.2 KB
/
Programa
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
/* Anillos
*Autor Noé Ameijeiras Maffeo
*Fecha 25/04/2018
*
*/
Anillo[] anillos;
int numAnillos=30;
int anilloActual=0;
int x=mouseX*10;
int y=mouseY*3;
int z=mouseX*mouseY;
int tiempo=millis();
void setup(){
fullScreen();
smooth();
anillos= new Anillo[numAnillos];
for (int i=0; i<numAnillos; i++) {
anillos[i]=new Anillo();
}
}
void draw() {
background(0);
if (tiempo/100==tiempo%10){
anillos[anilloActual].inicio(mouseX,mouseY);
anilloActual++;
if (anilloActual>=numAnillos) {
anilloActual=0;
}
}
for(int i=0; i<numAnillos; i++) {
anillos[i].crecer();
anillos[i].mostrar();
}
}
class Anillo{
float x, y;
float diametro;
boolean on =false;
void inicio(float xpos, float ypos) {
x=xpos;
y=ypos;
on=true;
diametro=1;
}
void crecer() {
if (on==true) {
diametro+=7;
if (diametro>int(random(100,500))) {
on=false;
}
}
if (on==false) {
diametro-=7;
if (diametro<=0) {
on=true;
}
}
}
void mostrar() {
if (on==true) {
noFill();
strokeWeight(4);
stroke(x,y,z);
ellipse(x,y,diametro,diametro);
}
if (on==false) {
noFill();
strokeWeight(4);
stroke(x,y,z);
ellipse(x,y,diametro,diametro);
}
}
}