public class sketch_editor4 extends PApplet {
public void setup() {
size(200, 200);
}
public void draw() {
if(mouseX < 70) {
cursor(CROSS);
} else {
cursor(HAND);
}
}
public void mousePressed(){
background(190);
ellipse(mouseX, mouseY, mouseX, mouseY);
fill(255);
}
static public void main(String args[]) {
PApplet.main(new String[] { "--bgcolor=#F0F0F0", "sketch_editor4" });
}
}
Aquí podemos encontrar las exploraciones, proyectos personales y comentarios de lo explorado en processing.
sábado, 20 de agosto de 2011
viernes, 12 de agosto de 2011
primer programa
saludo.html
Página Web con applet
Import java.awt.*;
Import java.applet.Applet;
public class saludo extends Applet {
public void paint (Graphics g);
g.drawString("hola", 50, 50);
g.drawString("Muy bien", 50, 100);
}
}
Import java.awt.*;
Import java.applet.Applet;
public class saludo extends Applet {
public void paint (Graphics g);
g.drawString("hola", 50, 50);
g.drawString("Muy bien", 50, 100);
}
}
domingo, 22 de mayo de 2011
jueves, 19 de mayo de 2011
Aviso
// An array of news headlines
String[] headlines = {
"Favor de tomar en cuenta la fecha de entrega de los productos del I Taller Virtual." ,
"El 23 de mayo es la fecha lìmite para entregar los productos." ,
};
PFont f; // Global font variable
float x; // Horizontal location
int index = 0;
void setup() {
size(400,200);
f = createFont( "Arial" ,16,true);
// Initialize headline offscreen
x = width;
}
void draw() {
background(255);
fill(0);
// Display headline at x location
textFont(f,16);
textAlign (LEFT);
// A specific String from the array is displayed according to the value of the "index" variable.
text(headlines[index],x,180);
// Decrement x
x = x - 3;
// If x is less than the negative width, then it is off the screen
// textWidth() is used to calculate the width of the current String.
float w = textWidth(headlines[index]);
if (x < -w) {
x = width;
// index is incremented when the current String has left the screen in order to display a new String.
index = (index + 1) % headlines.length;
}
}
String[] headlines = {
"Favor de tomar en cuenta la fecha de entrega de los productos del I Taller Virtual." ,
"El 23 de mayo es la fecha lìmite para entregar los productos." ,
};
PFont f; // Global font variable
float x; // Horizontal location
int index = 0;
void setup() {
size(400,200);
f = createFont( "Arial" ,16,true);
// Initialize headline offscreen
x = width;
}
void draw() {
background(255);
fill(0);
// Display headline at x location
textFont(f,16);
textAlign (LEFT);
// A specific String from the array is displayed according to the value of the "index" variable.
text(headlines[index],x,180);
// Decrement x
x = x - 3;
// If x is less than the negative width, then it is off the screen
// textWidth() is used to calculate the width of the current String.
float w = textWidth(headlines[index]);
if (x < -w) {
x = width;
// index is incremented when the current String has left the screen in order to display a new String.
index = (index + 1) % headlines.length;
}
}
lunes, 21 de marzo de 2011
Gancho: Lineas y elipses con movimientos
import processing.core.*;
import processing.xml.*;
import java.applet.*;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
import java.awt.event.FocusEvent;
import java.awt.Image;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import java.util.regex.*;
public class lineas_y_elipses_con_mov extends PApplet {
int x0 = 10;
int x1 = 20;
int x2 = 30;
int x3 = 40;
public void draw( ){
background(190);
size (200, 200);
background (380); // Sirve para dar color a la ventana
fill (145);
line (x0, 100, 10, 10 );
ellipse (x0, 100, 5, 5 );
x0=x0+1;
fill (35);
line (x1, 100, 10, 10 );
ellipse (x1, 100, 7, 7 ); // los numeros 10 es el tama\u00f1o del circulo
// y los numeros 100 es la posici\u00f3n de coordenada x
x1=x1+1;
fill (161);
line (x2, 100, 10, 10 );
ellipse (x2, 100, 8, 8 );
x2=x2+1;
fill (25);
line (x3, 100, 10, 10 );
ellipse (x3, 100, 10, 10 );
x3=x3+1;
}
static public void main(String args[]) {
PApplet.main(new String[] { "--present", "--bgcolor=#666666", "--stop-color=#cccccc", "lineas_y_elipses_con_mov" });
}
}
import processing.xml.*;
import java.applet.*;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
import java.awt.event.FocusEvent;
import java.awt.Image;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import java.util.regex.*;
public class lineas_y_elipses_con_mov extends PApplet {
int x0 = 10;
int x1 = 20;
int x2 = 30;
int x3 = 40;
public void draw( ){
background(190);
size (200, 200);
background (380); // Sirve para dar color a la ventana
fill (145);
line (x0, 100, 10, 10 );
ellipse (x0, 100, 5, 5 );
x0=x0+1;
fill (35);
line (x1, 100, 10, 10 );
ellipse (x1, 100, 7, 7 ); // los numeros 10 es el tama\u00f1o del circulo
// y los numeros 100 es la posici\u00f3n de coordenada x
x1=x1+1;
fill (161);
line (x2, 100, 10, 10 );
ellipse (x2, 100, 8, 8 );
x2=x2+1;
fill (25);
line (x3, 100, 10, 10 );
ellipse (x3, 100, 10, 10 );
x3=x3+1;
}
static public void main(String args[]) {
PApplet.main(new String[] { "--present", "--bgcolor=#666666", "--stop-color=#cccccc", "lineas_y_elipses_con_mov" });
}
}
Suscribirse a:
Entradas (Atom)