ตัวอย่าง บอลลูน
void draw() {
size(ุ600, 300);
frameRate(20);
background(random(200), random(200), random(200));//random RGB background
int x=mouseX;
int y=100;
if (x<100) {
x=100;
fill(#DD0000);
} else {
if (x>500) {
x=500;
}
if (x>100) {
fill(#0000DD);
}
if (x<500) {
fill(#00DD00);
}
}
draw_balloon(x, y);
}
//balloon funnction
void draw_balloon(int x, int y) {
int radius = 100;
int string_length = 150;
strokeWeight(13);
line(x, y, x, y + string_length);
ellipse(x, y, radius, radius);
}
size(ุ600, 300);
frameRate(20);
background(random(200), random(200), random(200));//random RGB background
int x=mouseX;
int y=100;
if (x<100) {
x=100;
fill(#DD0000);
} else {
if (x>500) {
x=500;
}
if (x>100) {
fill(#0000DD);
}
if (x<500) {
fill(#00DD00);
}
}
draw_balloon(x, y);
}
//balloon funnction
void draw_balloon(int x, int y) {
int radius = 100;
int string_length = 150;
strokeWeight(13);
line(x, y, x, y + string_length);
ellipse(x, y, radius, radius);
}