Wednesday, June 11, 2008

Thursday, February 28, 2008

anna version 2

...i even made a version 3...
why am i still working on this?

guess i'm in love~


video

Monday, February 18, 2008

pixilation

video

this is not the version that i showed on class,i don't have that one on my computer.i made it earlier and then deleted some of the effects because i thought there were too much distraction.

Thursday, December 13, 2007

ICM final

::What's Mine is Yours::

video
Project Description
:: Sonia Sound Library
* import Sonia Sound Library;
* Sample sound object;
(background music and thunder)
* Start Sonia in Setup();
* Creat new sample objects for sound “airwar.wav” and “t.wav” in Setup();
* Play background music when mousePressed() in draw function;
* Play sound of thunder when keyPressed() in draw function;
* Close sound library;
:: Image
* upload image as background
(background image and picture of lighting)
* display picture of lighting when mousePressed();
:: Text
* String the message “YOURS” at the beginning;
* Load text font inSetup();
* Set 1st character of the text “YOURS” at pixel 380 in draw();
* Use a for loop and CharAt() function to display text character by character in draw();
* Set all characters 14 pixels apart;
* Set random color and textSize in draw();
* Display message “what’s”,”mine” and ”is” separately in draw();
:: Button objects (rainbow)
* initialize Button objects in Setup() by calling constructor which is defined by arguments;
* operate Button object in draw() by calling object methods;
* define a button class
Variables :x,y,width,height;
Constructor
Functions:display()
:: an array for multiple Arc objects as wave
* an array of 1000 Arc objects;
* initialize each Arc object using a for loop in Setup();
* run each Arc object using for loop in draw();
* run fall() when keyPressed();
* define an Arc class
variables: x1,y1,width1,height1;
constructors
function: jiggle(), display(),fall()
:: an array of 1000 drop objects
* initialize each drop object
* run
* define a drop class
variables: xpos,ypos,speed,rainSize
function: fall(),display()
Code
import pitaru.sonia_v2_9.*;
//upload image
PImage img;
PImage img1;
//sample sound object
Sample airwar;
Sample t;
//the message to be displayed
String message="YOURS";
PFont f;
//an array of multiple arc objects
Arc[] arcs=new Arc[1000];
//an array of drop objects
Drop[] drops =new Drop[1000];
int totalDrops=0;

Button myButton1;
Button myButton2;
Button myButton3;
Button myButton4;
Button myButton5;
Button myButton6;
Button myButton7;
Button myButton8;
Button myButton9;
//input the value of stop of each layer of rainbow
int stop=0;

void setup(){
frameRate(20);
size(468,700);
smooth();
Sonia.start(this);
//load background image
img=loadImage("couple.jpg");
img1=loadImage("lighting.jpg");
//load font
f=loadFont("D.vlw");
textFont(f,16);
//creat new samples object 4 sound
airwar= new Sample("airwar.wav");
t=new Sample("t.wav");
//initialize each Arc object using a for loop
for (int i=0;i //x=random(width),y=random(height),width=70,height=50
arcs[i]=new Arc(random(width),650,50,30);
}
//initialize each Drop object using a for loop
for(int i=0;i drops[i]=new Drop();
}
//initialize button objects by calling constructor which is defined with argument
myButton1=new Button(234,220,350,400);
myButton2=new Button(234,220,300,360);
myButton3=new Button(234,220,275,340);
myButton4=new Button(234,220,250,320);
myButton5=new Button(234,220,225,300);
myButton6=new Button(234,220,200,260);
myButton7=new Button(234,220,175,220);
myButton8=new Button(234,220,150,170);
myButton9=new Button(234,220,100,100);
}

void draw(){
background(255);
image(img,0,0);
//the first character starts at pixel 150
int pixel=143;
for(int i=0;i //random color of text
fill(random(255));
textSize(25);
text(message.charAt(i),pixel,380);
//all characters are spaced 10 pixels apart
pixel=pixel+14;
}

//run each Arc object using a for loop
for(int i=0; i arcs[i].display();
arcs[i].jiggle();
}
drops[totalDrops]=new Drop();
totalDrops++;
if(totalDrops>=drops.length){
totalDrops=0;
}
for(int i=0; i drops[i].display();
drops[i].fall();
}
//operate Button object by calling object methods
myButton1.display(mouseX,mouseY);
myButton2.display(mouseX,mouseY);
myButton3.display(mouseX,mouseY);
myButton4.display(mouseX,mouseY);
myButton5.display(mouseX,mouseY);
myButton6.display(mouseX,mouseY);
myButton7.display(mouseX,mouseY);
myButton8.display(mouseX,mouseY);
myButton9.display(mouseX,mouseY);
//draw a white arc to make arcs more rainbow like
noStroke();
fill(255);
arc(234,220,120,100,PI,0);
//display text"WHAT'S MINE IS"
textFont(f,16);
fill(200,200,200);
text("What's",150,330);
text("Mine",161,344);
text("is",175,357);
}

//play airwar while mouse click on the button
void mousePressed(){
if(myButton1.contains(mouseX,mouseY)){
airwar.play();
}

}
void keyPressed(){
tint(255,100);
image(img1,0,0);
for(int i=0;i arcs[i].fall();
}
t.play();
}
public void stop(){
Sonia.stop();
super.stop();
}
//a class to describe button
class Button{
float x;
float y;
float w;
float h;
//button's constructor
Button(float x_,float y_,float w_,float h_){
x=x_;
y=y_;
w=w_;
h=h_;
}
// if a point is inside the play button
boolean contains(float mx,float my){
if (dist(mx,my,x,y)<(w-100)){
return true;
}
else{
return false;
}
}
//display the button
void display(float mx,float my){
float r;
float g;
float b;
if (contains(mx,my)){
r=random(255);
g=random(255);
b=random(255);
fill(r,g,b);
}
else{
fill(119,152,202);
}
noStroke();
arc(x,y,w,h,PI,0);
}
}
//a class to describe arcs
class Arc{
//arcs' variables
float x1;
// float x2;
float y1;
// float y2;
float width1;
float height1;
//arcs' constructor
Arc(float x1_,float y1_,float width1_, float height1_){
x1=x1_;
y1=y1_;
width1=width1_;
height1=height1_;
}
//make arcs jiggle
void jiggle(){
float speed=20;
//change the y and x location of arrows randomly
x1=x1+random(-1,1)*speed;
y1=y1+random(-1,1)*speed;
//constrain arrows in the window
x1=constrain(x1,0,width);
y1=constrain(y1,400,height);
}
//display arcs
void display(){
fill(119,152,202,random(30,70));
strokeWeight(2);
stroke(119,152,202,100);
arc(x1,y1,width1,height1,PI,0);
}
void fall(){
float speed=50;
y1+= speed;
y1=constrain(y1,600,height);
}
}
//a class to describe rain
class Drop{
//drop variables
float xpos;
float ypos;
float speed;
float rainSize;
//drop constructor
Drop(){
rainSize=12;
xpos=random(width);
ypos=-rainSize*4;
speed=random(30,60);
}

void fall(){
ypos += speed;
ypos=constrain(ypos,-50,700);
}
boolean reachedBotton(){
if(ypos>height+rainSize*4){
return true;
}
else{
return false;
}
}
void display(){
fill(119,152,202,100);
noStroke();
for(int i=2;i ellipse(xpos,ypos+i*4,i*0.7,i*0.7);
}
}
}

PCOM final






video

Comlab final * What r u looking at?

video