processing
(no terminado)
int n=0;
int maxnum=10;
void setup(){
fill(0);
size(800,600);
textSize(20);
background(0);
}
void draw(){
text(n,width/2,height/(maxnum));
maxnum=maxnum-1;
n=n+1;
delay(100);
if (n==4){
fill(255,0,0);
}
else{
fill(255);
}
if (n>maxnum){
noLoop();
}
}
size(800,600);
background(0);
fill(255);
for(int a = 0; a<10; a=a+1){
for(int b =0; b<10; b=b+1){
text(a*10+b,(width/10)*b+20,(height/10)*a+20);
if(b==a){
fill(255,0,0);
else{
fill(255);
}
}
}
}
EJERCICIO 2. area del rectangulo
size(800,600);
background(0);
fill(255);
float a=0;
float y = 37;
float x = 50;
rect(x,y,400,300);
a=x * y;
fill(255);
text("el area del cuadrado es:"+a,300,500);
EJERCICIO 3
float ax=200;
float ay=400;
float bx=650;
float by=150;
float d=0;
float a=0;
float b=0;
background(255);
fill(0);
size(800,600);
ejes()
circle(ax,ay,8);
circle(bx,by,8);
line(ax,ay,bx,by);
a =ay- ax;
b =bx-by;
d= sqrt(sq(a)+sq(b));
text("la distancia entre los dos puntos es de: "+d,350,500);
Comentarios
Publicar un comentario