void setup() {
size(400,400);
smooth();
background(0);
}
void draw() {
if(mousePressed) {
fill(#FF0033);
stroke(#CC0000);
strokeWeight(3);
} else {
stroke(#330099);
fill(#00CCCC);
}
ellipse(200,200,mouseX,mouseY);
}
miércoles, 31 de agosto de 2011
Ejercicio cuadrados - Cruz
size(200,200);
background(0);
fill(#990000);
rect(20,20,40,40);
fill(#FF0000);
rect(40,40,40,40);
fill(#FF3333);
rect(60,60,40,40);
fill(#336600);
rect(140,20,40,40);
fill(#66CC00);
rect(120,40,40,40);
fill(#99FF33);
rect(100,60,40,40);
fill(#006666);
rect(20,140,40,40);
fill(#00CCCC);
rect(40,120,40,40);
fill(#66CCFF);
rect(60,100,40,40);
fill(#330033);
rect(140,140,40,40);
fill(#CC00CC);
rect(120,120,40,40);
fill(#FF66FF);
rect(100,100,40,40);
background(0);
fill(#990000);
rect(20,20,40,40);
fill(#FF0000);
rect(40,40,40,40);
fill(#FF3333);
rect(60,60,40,40);
fill(#336600);
rect(140,20,40,40);
fill(#66CC00);
rect(120,40,40,40);
fill(#99FF33);
rect(100,60,40,40);
fill(#006666);
rect(20,140,40,40);
fill(#00CCCC);
rect(40,120,40,40);
fill(#66CCFF);
rect(60,100,40,40);
fill(#330033);
rect(140,140,40,40);
fill(#CC00CC);
rect(120,120,40,40);
fill(#FF66FF);
rect(100,100,40,40);
Ejercicio triangulos - mouse
void setup() {
size(400,400);
smooth();
background(0);
}
void draw() {
if(mousePressed) {
fill(255,255,0);
} else {
fill(255,0,255);
}
triangle(40 ,200,360,200, mouseX,mouseY);
}
size(400,400);
smooth();
background(0);
}
void draw() {
if(mousePressed) {
fill(255,255,0);
} else {
fill(255,0,255);
}
triangle(40 ,200,360,200, mouseX,mouseY);
}
ejercicio de lineas - Diamante
size(200,200);
background(0);
stroke(#999933);
line(70,60,130,60);
line(60,80,70,60);
line(140,80,130,60);
//---------------------superior
line(70,60,80,80);
line(80,80,90,60);
line(90,60,100,80);
line(100,80,110,60);
line(110,60,120,80);
line(120,80,130,60);
line(60,80,140,80);
//---------------------zig-zag
line(60,80,100,140);
line(140,80,100,140);
line(80,80,100,140);
line(100,80,100,140);
line(120,80,100,140);
//----------------------inferior
stroke(#FFFFCC);
line(120,50,140,70);
line(130,50,130,70);
line(120,70,140,50);
//-----------------------brillo
background(0);
stroke(#999933);
line(70,60,130,60);
line(60,80,70,60);
line(140,80,130,60);
//---------------------superior
line(70,60,80,80);
line(80,80,90,60);
line(90,60,100,80);
line(100,80,110,60);
line(110,60,120,80);
line(120,80,130,60);
line(60,80,140,80);
//---------------------zig-zag
line(60,80,100,140);
line(140,80,100,140);
line(80,80,100,140);
line(100,80,100,140);
line(120,80,100,140);
//----------------------inferior
stroke(#FFFFCC);
line(120,50,140,70);
line(130,50,130,70);
line(120,70,140,50);
//-----------------------brillo
miércoles, 24 de agosto de 2011
Ejercicios siguiendo al mouse
void setup(){
size (400, 400);
}
void draw(){
line (pmouseX, pmouseY, mouseX, mouseY);
}
void setup(){
size(400,400);
smooth();
background(0);
frameRate(30);
}
void draw(){
stroke(mouseX, 0 , mouseY);
float distance = dist(pmouseX, pmouseY, mouseX, mouseY);
float maxStroke = 15;
strokeWeight(maxStroke - constrain(distance, 0, maxStroke));
line(pmouseX, pmouseY, mouseX, mouseY);
}
void mouseClicked(){
rectMode(CENTER);
fill(mouseY, 255, mouseX);
noStroke();
rect(mouseX, mouseY, 30, 30);
}
void keyPressed(){
background(0);
}
size (400, 400);
}
void draw(){
line (pmouseX, pmouseY, mouseX, mouseY);
}
void setup(){
size(400,400);
smooth();
background(0);
frameRate(30);
}
void draw(){
stroke(mouseX, 0 , mouseY);
float distance = dist(pmouseX, pmouseY, mouseX, mouseY);
float maxStroke = 15;
strokeWeight(maxStroke - constrain(distance, 0, maxStroke));
line(pmouseX, pmouseY, mouseX, mouseY);
}
void mouseClicked(){
rectMode(CENTER);
fill(mouseY, 255, mouseX);
noStroke();
rect(mouseX, mouseY, 30, 30);
}
void keyPressed(){
background(0);
}
1ra creacion siguiendo al mouse
Ejercicios en hoja milinetrada de processing - 2da clase
elipse con canvas aumentado
elipses siguiendo al mouse
void setup() {
size(480,120);
smooth();
}
void draw() {
if(mousePressed) {
fill(0);
} else {
fill(255);
}
ellipse(mouseX, mouseY, 80,80);
}
Linea diagonal
triangulo
cuadrilatero
rectangulo
circulo
arco
Hoja milimetrada con calculos de ubicacion y tamaño de cada ejercicio anterior.
elipses siguiendo al mouse
void setup() {
size(480,120);
smooth();
}
void draw() {
if(mousePressed) {
fill(0);
} else {
fill(255);
}
ellipse(mouseX, mouseY, 80,80);
}
Linea diagonal
triangulo
cuadrilatero
rectangulo
circulo
arco
Hoja milimetrada con calculos de ubicacion y tamaño de cada ejercicio anterior.
miércoles, 17 de agosto de 2011
Pruebas de processing
Primera prueba de una elipse
segunda prueba agregando cuadrado
Tarea a realizar:
Demo1.
size(200, 200);
background(0);
rectMode(CORNER);
rect(75, 10, 50, 150);
fill(185);
rectMode(CENTER);
rect(20, 100, 40, 55);
rectMode(CORNERS);
fill(64);
rect(0, 175, 200, 190);
Demo2.
size(200, 200);
noStroke();
background(0);
smooth();
ellipseMode(CORNER);
ellipse(75, 10, 50, 150);
ellipseMode(CENTER);
fill(185);
noSmooth();
ellipse(50, 100, 100, 55);
smooth();
ellipseMode(CORNERS);
fill(64);
ellipse(0, 155, 200, 190);
rectMode(CORNERS);
noFill();
strokeWeight(2);
stroke(255);
rect(0,155,200,190);
Demo3.
size(300, 300);
background(0);
noStroke();
fill(225, 0, 0);
rect(0, 0, 100, 50);
fill(0, 80, 0);
rect(100, 0, 100, 50);
fill(150, 150, 255);
rect(200, 0, 100, 50);
fill(128);
rect(0, 50, 300, 100);
Creacion propia aplicando lo aprendido:
size(400,400);
background(0);
smooth();
fill(#990000);
ellipse(200,200,400,400);
smooth();
fill(#990033);
ellipse(200,200,350,350);
smooth();
fill(#990066);
ellipse(200,200,300,300);
smooth();
fill(#990099);
ellipse(200,200,250,250);
smooth();
fill(#9900CC);
ellipse(200,200,200,200);
smooth();
fill(#9900FF);
ellipse(200,200,150,150);
//---------------------------------ellipses
smooth();
fill(#9900CC);
rect(150,150,100,100);
smooth();
fill(#990099);
rect(160,160,80,80);
smooth();
fill(#990066);
rect(170,170,60,60);
smooth();
fill(#990033);
rect(180,180,40,40);
smooth();
fill(#990000);
rect(190,190,20,20);
//-------------------------------rects1
smooth();
fill(#990000);
rect(252,190,20,20);
smooth();
fill(#990033);
rect(277,190,20,20);
smooth();
fill(#990066);
rect(302,190,20,20);
smooth();
fill(#990099);
rect(327,190,20,20);
smooth();
fill(#9900CC);
rect(352,190,20,20);
smooth();
fill(#9900FF);
rect(377,190,20,20);
//--------------------------------rect2,right
smooth();
fill(#990000);
rect(128,190,20,20);
smooth();
fill(#990033);
rect(103,190,20,20);
smooth();
fill(#990066);
rect(78,190,20,20);
smooth();
fill(#990099);
rect(53,190,20,20);
smooth();
fill(#9900CC);
rect(28,190,20,20);
smooth();
fill(#9900FF);
rect(3,190,20,20);
//----------------------------rect3,left
smooth();
fill(#990000);
rect(190,128,20,20);
smooth();
fill(#990033);
rect(190,103,20,20);
smooth();
fill(#990066);
rect(190,78,20,20);
smooth();
fill(#990099);
rect(190,53,20,20);
smooth();
fill(#9900CC);
rect(190,28,20,20);
smooth();
fill(#9900FF);
rect(190,3,20,20);
//--------------------------------rect4,up
smooth();
fill(#990000);
rect(190,252,20,20);
smooth();
fill(#990033);
rect(190,277,20,20);
smooth();
fill(#990066);
rect(190,302,20,20);
smooth();
fill(#990099);
rect(190,327,20,20);
smooth();
fill(#9900CC);
rect(190,352,20,20);
smooth();
fill(#9900FF);
rect(190,377,20,20);
//--------------------------------rect5,down
segunda prueba agregando cuadrado
Tarea a realizar:
Demo1.
size(200, 200);
background(0);
rectMode(CORNER);
rect(75, 10, 50, 150);
fill(185);
rectMode(CENTER);
rect(20, 100, 40, 55);
rectMode(CORNERS);
fill(64);
rect(0, 175, 200, 190);
Demo2.
size(200, 200);
noStroke();
background(0);
smooth();
ellipseMode(CORNER);
ellipse(75, 10, 50, 150);
ellipseMode(CENTER);
fill(185);
noSmooth();
ellipse(50, 100, 100, 55);
smooth();
ellipseMode(CORNERS);
fill(64);
ellipse(0, 155, 200, 190);
rectMode(CORNERS);
noFill();
strokeWeight(2);
stroke(255);
rect(0,155,200,190);
Demo3.
size(300, 300);
background(0);
noStroke();
fill(225, 0, 0);
rect(0, 0, 100, 50);
fill(0, 80, 0);
rect(100, 0, 100, 50);
fill(150, 150, 255);
rect(200, 0, 100, 50);
fill(128);
rect(0, 50, 300, 100);
Creacion propia aplicando lo aprendido:
size(400,400);
background(0);
smooth();
fill(#990000);
ellipse(200,200,400,400);
smooth();
fill(#990033);
ellipse(200,200,350,350);
smooth();
fill(#990066);
ellipse(200,200,300,300);
smooth();
fill(#990099);
ellipse(200,200,250,250);
smooth();
fill(#9900CC);
ellipse(200,200,200,200);
smooth();
fill(#9900FF);
ellipse(200,200,150,150);
//---------------------------------ellipses
smooth();
fill(#9900CC);
rect(150,150,100,100);
smooth();
fill(#990099);
rect(160,160,80,80);
smooth();
fill(#990066);
rect(170,170,60,60);
smooth();
fill(#990033);
rect(180,180,40,40);
smooth();
fill(#990000);
rect(190,190,20,20);
//-------------------------------rects1
smooth();
fill(#990000);
rect(252,190,20,20);
smooth();
fill(#990033);
rect(277,190,20,20);
smooth();
fill(#990066);
rect(302,190,20,20);
smooth();
fill(#990099);
rect(327,190,20,20);
smooth();
fill(#9900CC);
rect(352,190,20,20);
smooth();
fill(#9900FF);
rect(377,190,20,20);
//--------------------------------rect2,right
smooth();
fill(#990000);
rect(128,190,20,20);
smooth();
fill(#990033);
rect(103,190,20,20);
smooth();
fill(#990066);
rect(78,190,20,20);
smooth();
fill(#990099);
rect(53,190,20,20);
smooth();
fill(#9900CC);
rect(28,190,20,20);
smooth();
fill(#9900FF);
rect(3,190,20,20);
//----------------------------rect3,left
smooth();
fill(#990000);
rect(190,128,20,20);
smooth();
fill(#990033);
rect(190,103,20,20);
smooth();
fill(#990066);
rect(190,78,20,20);
smooth();
fill(#990099);
rect(190,53,20,20);
smooth();
fill(#9900CC);
rect(190,28,20,20);
smooth();
fill(#9900FF);
rect(190,3,20,20);
//--------------------------------rect4,up
smooth();
fill(#990000);
rect(190,252,20,20);
smooth();
fill(#990033);
rect(190,277,20,20);
smooth();
fill(#990066);
rect(190,302,20,20);
smooth();
fill(#990099);
rect(190,327,20,20);
smooth();
fill(#9900CC);
rect(190,352,20,20);
smooth();
fill(#9900FF);
rect(190,377,20,20);
//--------------------------------rect5,down
Suscribirse a:
Entradas (Atom)