project 3c

project 3c

I’m using Music, Text, Image, Loop, Shape, Random, etc. for my final project. I made a clock. I made three circles to represent hours, minutes, and seconds. Also, I added an image to be the clock scale. In addition, I added a background music follow the clock.

My code:
//using Music, Text, Image, Loop, Shape, Random etc.

import ddf.minim.*; //add background music and loop the music
AudioPlayer[] player = new AudioPlayer[1];
Minim minim;

color colA, colB, colC; // initialize colors

void setup() {
size(400,400); // init window
noStroke();
minim = new Minim(this);
player[0] = minim.loadFile(“file.mp3”, 2048);

colA = color(250,130,126);
colB = color(210,240,123);
colC = color(98,216,209);
}

void draw() {
background(185,150,150); // background color

if (!player[0].isPlaying()) {
player[0].rewind();
player[0].play();
}

float i = 80 + random(140); // random i

PImage img;
img = loadImage(“1.png”); // load image for clock scale
image(img, 90, 90, 220,220);

PFont font;
font = loadFont(“AntiqueOliveStd-Bold-48.vlw”);
textFont(font);
fill(i, 100, 240);
text(“MY CLOCK”, 90, 70);

// hour:
fill(colA);
float hAngle = map(hour()%12, 0, 12, 0, 2*PI);
arc(200,200,180,180, -PI/2, hAngle-PI/2 ); // arc for hours
fill(185,150,150); ellipse(200,200,140,140);
textSize(30);
fill(colA);
text(hour()+”:”, 130, 350); // text for hours

// minute:
fill(colB);
float mAngle = map(minute(), 0, 60, 0, 2*PI);
arc(200,200,140,140, -PI/2, mAngle-PI/2 ); // arc for minutes
fill(185,150,150); ellipse(200,200,100,100);
textSize(30);
fill(colB);
text(minute()+”:”, 180, 350); // text for seconds

// second:
fill(colC);
float sAngle = map(second(), 0, 60, 0, 2*PI);
arc(200,200,100,100, -PI/2, sAngle-PI/2 ); // arc for seconds
fill(185,150,150); ellipse(200,200,60,60);
textSize(30);
fill(colC);
text(second(), 230, 350); // text for seconds
}

For my blog entries:
1. Dion’s blog
URL: http://nmed3680b.wordpress.com/2014/03/26/project-3b/comment-page-1/#comment-1
Date: April 5, 2014 at 7:50pm
My comment: “It’s very clear about your comments on your sketch. In this way, I can follow your code very well and know clearly about what will happen in your project.”

2. John’s blog
URL: http://johnong5015.wordpress.com/2014/03/24/project-3b-processing-2/comment-page-1/#comment-3
Date: April 5, 2014 at 8:05 pm
My comment: “Really cool project! I really your circle shape with color. And according to your code, I learnt something in your mouse pressed part.”

3. Jenna’s blog
URL: http://jennathompsonblog.wordpress.com/2014/03/25/processing-project-3b-interaction-and-random/comment-page-1/#comment-3
Date: April 8, 2014 at 10:52 pm
My comment: “I think you did an awesome project, also the blog explanation. You explained the reasons about why using these requirements. I can follow your steps very well. In addition, I think you add an explanation part is a good thing for people who are watching your posts. I will also cover a explanation part in my next project’s for my blog.”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s