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
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()) {

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”);
fill(i, 100, 240);
text(“MY CLOCK”, 90, 70);

// hour:
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);
text(hour()+”:”, 130, 350); // text for hours

// minute:
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);
text(minute()+”:”, 180, 350); // text for seconds

// second:
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);
text(second(), 230, 350); // text for seconds

For my blog entries:
1. Dion’s blog
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
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
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.”


Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s