We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Need help creating a Clock Application
Page Index Toggle Pages: 1
Need help creating a Clock Application (Read 1593 times)
Need help creating a Clock Application
Feb 25th, 2010, 4:54pm
 
Hi... I'm relatively new to Processing.

I saw an awesome clock installation at the Decode Exhibition at V&A Museum in London and I'm planning to make a Processing version of it.

It basically works on the following basis:
1. The visual is like a digital clock
2. Quirky images of numbers from 0 to 60 are used to display the time

This is what I'm planning to do... please let me know if I'm on the right track and your suggestions would be very welcome:

1. Creating arrays of the images from 0 to 60
2. Using hour, minutes and second functions in Processing
3. Putting it altogether...

I'll need to hack some code. Does anyone know of similar applications?

Thanks,
Tarun

ps. I had posted this in the wrong section... and owing to an error (clicking on "Post" led to a site error message) I kind of multiple posted. Apologies for that.
Re: Need help creating a Clock Application
Reply #1 - Feb 25th, 2010, 4:58pm
 
its not right in the exhibition section either... Smiley
this is a place for showing your projects.

if you want to post it in the right place. you should post it in programms. but just leave it in general, where my answer is, phiLho will move it tomorrow.
Re: Need help creating a Clock Application
Reply #2 - Feb 25th, 2010, 5:03pm
 
Shucks... again Tongue
Re: Need help creating a Clock Application
Reply #3 - Feb 25th, 2010, 10:22pm
 
Aphorist wrote on Feb 25th, 2010, 4:54pm:
Does anyone know of similar applications

Similar ideas, at least.
For example, see the various Human Clocks.
The code to do that is quite trivial...
Re: Need help creating a Clock Application
Reply #4 - Feb 26th, 2010, 7:25am
 
The problem I'm having is figuring out this bit:

Lets say the time is- 09:08:03

I'm not sure how to place the 0s when 09 becomes 10 or 23:59:59 becomes  00:00:00.

I was initially thinking of getting images for numbers from 00 to 59, but as Cedric suggested just 0 to 9 will be enough as they can be recycled. I'm confused about the unit position of the numbers.

I'm not sure if this is making any sense.
Re: Need help creating a Clock Application
Reply #5 - Feb 26th, 2010, 7:50am
 
Use nf() along with the time functions to get a properly formatted string.
Then parse this string, mapping string digits to images in an array.
Display the images with img(), incrementing an horizontal position by the width of each image.
Re: Need help creating a Clock Application
Reply #6 - Mar 12th, 2010, 5:03pm
 
So far I've created an array of images from 0 to 9. I've also created a time string using nf() as suggested.

How do I map strings digits to images in the array?
Re: Need help creating a Clock Application
Reply #7 - Mar 13th, 2010, 2:42am
 
Convert digit chars to numerical digit (using int()).
Use the result as index in your array of PImages.
Page Index Toggle Pages: 1